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

skip updates where possible #769

Merged
merged 14 commits into from
Aug 14, 2017
Merged

skip updates where possible #769

merged 14 commits into from
Aug 14, 2017

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented Aug 14, 2017

This will fix #768. With #760 in mind, I'm going beyond just skipping tag updates, and changing how updates work at a slightly more fundamental level. _set is now a choke point where all the differs checks take place, and rather than passing round the new state object, we pass around a changed object that tracks which keys are actually dirty. This can be used by dispatchObservers, recompute and so on.

_set is now also part of the shared prototype. The only thing that changed from one component to the next is recompute, so that's now a prototype method rather than a standalone function. This will result in byte savings in apps with multiple components.

TODO:

  • apply same thing to raw tags, and attributes
  • don't bother caching values of text nodes etc where it's unnecessary. we can just use the changed check

@Rich-Harris Rich-Harris changed the title [WIP] skip updates where possible skip updates where possible Aug 14, 2017
@Rich-Harris
Copy link
Member Author

Taking the WIP tag off. This makes a huge performance difference on the app I'm currently working on

@Rich-Harris Rich-Harris merged commit 276b799 into master Aug 14, 2017
@Rich-Harris Rich-Harris deleted the gh-768 branch August 14, 2017 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tags and attributes should only be recomputed if necessary
1 participant