perf: match ownKeys perf to the one of objectSpread#10189
Merged
existentialism merged 3 commits intoJul 11, 2019
Conversation
nicolo-ribaudo
approved these changes
Jul 9, 2019
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11092/ |
jridgewell
approved these changes
Jul 9, 2019
JLHwung
force-pushed
the
object-spread2-performance-regression
branch
from
July 9, 2019 21:24
d5f8af0 to
49f8d4c
Compare
existentialism
approved these changes
Jul 9, 2019
existentialism
left a comment
Member
There was a problem hiding this comment.
👍 (especially the comment!)
Member
|
Thanks! (As a side note, I really like having more ✔️ than usual!) EDIT: I was going to merge this PR, I'll wait for CI to finish. |
Contributor
Author
The idea comes from discussion with @nicolo-ribaudo |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses a performance regression introduced at #10171.
Object.keysreturns a list of enumerable property names. Hence we filterenumerableonly on the property symbols. Note that this approach is also practiced inhelpers.objectSpread.In practice the most frequent use cases of objectSpread is merging two plain objects, which means we can skip a sweep of already enumerable property names. I also drafted a jsPerf snippet on the performance difference. It is 10% faster on V8 75 when merging two object with 512 keys.