Skip to content
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

Perf set changing prop #32574

Conversation

pkozlowski-opensource
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource commented Sep 10, 2019

This PR introduces a new benchmark that focuses on performance of property updates. It also contain a fix where by removing a megamorphic access we can speed up this new benchmark by ~30%.

Review commit by commit and check individual commit message for more details.

@pkozlowski-opensource pkozlowski-opensource added comp: ivy action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release and removed cla: yes labels Sep 10, 2019
@googlebot
Copy link

☹️ Sorry, but only Googlers may change the label cla: yes.

While determining a property name to bind to we were checking a mapping object
resulting in the megamorphic read. Replacing such read with a series of if checks
speeds up rproprty update benchmark ~30% (~1400ms down to ~1000ms).
@pkozlowski-opensource pkozlowski-opensource marked this pull request as ready for review September 10, 2019 11:48
@pkozlowski-opensource pkozlowski-opensource requested a review from a team as a code owner September 10, 2019 11:48
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 10, 2019
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

*
* Performance note: this function is written as a series of if checks (instead of, say, a property
* object lookup) for performance reasons - the series of `if` checks seems to be the fastest way of
* mapping property names. Do NOT change without benchmarking.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@kara kara added the action: presubmit The PR is in need of a google3 presubmit label Sep 10, 2019
'tabindex': 'tabIndex',
};
function mapPropName(name: string): string {
if (name === 'class') return 'className';
Copy link
Contributor

@mhevery mhevery Sep 10, 2019

Choose a reason for hiding this comment

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

I wonder if we could make this even faster if we did something like this:

const ch = name.charCodeAt(0);
if (ch === 99 /*c*/ || ch === 102 /*f*/' || ch === 105 /*i*/ || ch === 116 /*t*/ || ch === 't') {
  ...
}

@matsko
Copy link
Contributor

matsko commented Sep 11, 2019

@matsko matsko closed this in ea378a9 Sep 12, 2019
matsko pushed a commit that referenced this pull request Sep 12, 2019
While determining a property name to bind to we were checking a mapping object
resulting in the megamorphic read. Replacing such read with a series of if checks
speeds up rproprty update benchmark ~30% (~1400ms down to ~1000ms).

PR Close #32574
arnehoek pushed a commit to arnehoek/angular that referenced this pull request Sep 26, 2019
arnehoek pushed a commit to arnehoek/angular that referenced this pull request Sep 26, 2019
…2574)

While determining a property name to bind to we were checking a mapping object
resulting in the megamorphic read. Replacing such read with a series of if checks
speeds up rproprty update benchmark ~30% (~1400ms down to ~1000ms).

PR Close angular#32574
@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 Oct 13, 2019
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 action: presubmit The PR is in need of a google3 presubmit cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants