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

refactor(core): avoid object creation in bind #21155

Closed
wants to merge 1 commit into from

Conversation

kara
Copy link
Contributor

@kara kara commented Dec 23, 2017

Adds optimization to avoid creating unnecessary objects in bind instructions for render3.

The why, from Misko:

each object has an overhead 56 bytes plus any properties stored an it. So moving from object to Array saves 56 bytes per binding. (This is because we already paid the array overhead).

There is an additional benefit in that when reading location x in array we will cause a cache fetch which means that x+1 read will most likely result in cache hit. So we get benefit of locality. We also save the cost of dereferencing through an un-needed object.

@kara kara requested a review from mhevery December 23, 2017 00:47
@kara kara added area: core Issues related to the framework runtime action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 23, 2017
@mary-poppins
Copy link

You can preview ea0d721 at https://pr21155-ea0d721.ngbuilds.io/.

@mlc-mlapis
Copy link
Contributor

... to be able to understand better, is there a simple answer why the algorithm counts just with 8 parts ... and ends with data[bindingIndex++] = v7;? Also why is it so explicitly coded?

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 27, 2017
@mhevery mhevery closed this in 8bf1305 Dec 27, 2017
@kara kara added comp: ivy and removed area: core Issues related to the framework runtime labels Jan 10, 2018
@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 Sep 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 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