Skip to content

docs(material/autocomplete): use single map instead of two maps in a row #25167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ammarnajjar
Copy link
Contributor

Why:

The example code is highly trusted and sometimes
taken as is (copy-paste), so it is important to
have it optimised if possible.

what

Each map means an iteration over the array items.
By using single map, an iteration is saved, and
an approximate performance of about 38% is won.

I measured the performance here: https://jsbench.me/dbl4wkw3r9/1

The example code is highly trusted and sometimes
taken as is (copy-paste), so it is important to
have it optimized if possible.
Each map means an iteration over the array items.
By using single map, an iteration is saved, and
an approximate performance of about 38% is won.
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added docs This issue is related to documentation action: merge The PR is ready for merge by the caretaker merge safe target: patch This PR is targeted for the next patch release labels Jun 27, 2022
@crisbeto crisbeto merged commit 8ca012f into angular:main Jun 27, 2022
crisbeto pushed a commit that referenced this pull request Jun 27, 2022
…row (#25167)

* docs(material/autocomplete): use single map instead of two maps in a row

The example code is highly trusted and sometimes
taken as is (copy-paste), so it is important to
have it optimized if possible.
Each map means an iteration over the array items.
By using single map, an iteration is saved, and
an approximate performance of about 38% is won.

* docs(material/autocomplete): add trailing comma

(cherry picked from commit 8ca012f)
crisbeto pushed a commit that referenced this pull request Jun 27, 2022
…row (#25167)

* docs(material/autocomplete): use single map instead of two maps in a row

The example code is highly trusted and sometimes
taken as is (copy-paste), so it is important to
have it optimized if possible.
Each map means an iteration over the array items.
By using single map, an iteration is saved, and
an approximate performance of about 38% is won.

* docs(material/autocomplete): add trailing comma

(cherry picked from commit 8ca012f)
@ammarnajjar ammarnajjar deleted the docs/use-single-map-in-autocomplete-example branch June 27, 2022 13:11
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker docs This issue is related to documentation target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants