-
Notifications
You must be signed in to change notification settings - Fork 47k
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
[idea] Construct an array of strings for transactions instead of one big string #1542
Conversation
.push() can take multiple arguments, which might be faster. |
Updated code and perfs. IE9: http://i.imgur.com/Wu9518y.png Some quite conclusive (but not mindblowing) improvements in some tests it seems. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@jordwalke What do you think of this? |
Add harmony transform support in browser Fixes #1420. Moved some code around in the merge to account for more changes in the transform code. Conflicts: vendor/browser-transforms.js
Note to self, assigning to an index is considerably faster than push. |
I had a diff that did this previously. It's tricky because if you use the optimizations right, then string concatenation can actually be faster. I haven't looked at this closely enough to know but I suspect you might have some problems coordinating this with React ART. I definitely think that we'll probably do something like this but I think we need a bigger refactoring around the contract of the reconciler for things like React ART to plug into. Might not be worth while just doing this on it's own. |
@sebmarkbage Definitely, as the tests shows (not that I really trust them) there's probably nothing here worth bending backwards over either. If you overdo it just a little it actually becomes slower. This was just an FYI really, feel free to close. |
Another poo-commit.
It can probably be improved further (performance wise), but it has some interesting results, Chrome: http://imgur.com/pHROMTO (right/red is this PR, left/black is master)
While I find that those perf tests tend to differ between each try, there are some tests that seem to show a significant and stable improvement of 5-8% it seems. I would also assume that this improvement increases for larger DOM updates (especially the initial rendering).
Running it through my old "torture-test" of mounting and unmounting a large tree, IE8 shows 0 difference, but IE9 runs 20% faster and IE10/FF runs 10% faster and IE11/Chrome is around 5% faster (just for mount+unmount, so no rendering involved and not layouting either I think).
I'm assuming this would also put significantly less pressure on the GC as new strings don't have to be created for every concatenation.
Pending your input on whether to proceed (and do it proper) or not.