-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Improve performance by checking that the data changes #279
Conversation
After testing this in chrome, it seems that this only has such a big performance improvement for Firefox. I guess chrome must internally check if it changed and firefox doesn't. |
Depending on the expression, I was thinking about creating a helper for text nodes (and later also for attributes, see #25 ) that does memoization and comparison internally. |
Wow, that's an impressive speedup on Firefox. Memoizing helpers is definitely worth exploring — there might be an overhead involved (truthfully I have no idea) so maybe the right move in the meantime would be to assign |
Good idea about assigning |
I implemented the temporary variable thing, and extended this to |
Looks good. |
Basically, anything that touches the DOM is slow. Because if that, this PR checks if any data changes before touching the DOM.
You can see the performance by comparing the dbmonster built with this PR to the normal one: https://svelte-dbmonster-perf.surge.sh/dist/index.html
Here are some screenshots from my late 2012 i5 macbook pro:
The dbmonster based off this PR will jump up to 600fps, but the regular dbmonster doesn't go past 60fps. I'm not sure why the dbmonster based off this PR has such sudden fps jumps (although it doesn't drop below 60 for me.)