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

Optimize Map/Set fast key path. #397

Merged
merged 1 commit into from Jan 11, 2016
Merged

Conversation

cscott
Copy link
Collaborator

@cscott cscott commented Jan 10, 2016

The expression typeof x === 'some string' is treated as a peephole
optimization by JavaScript runtimes and optimized as a simple type test
without an explicit string comparison. Refactoring the typeof x part
into a variable cause this to be deoptimized: the type information
is lost and we end up doing actual string comparison operations at
runtime.

The expression `typeof x === 'some string'` is treated as a peephole
optimization by JavaScript runtimes and optimized as a simple type test
without an explicit string comparison.  Refactoring the `typeof x` part
into a variable cause this to be deoptimized: the type information
is lost and we end up doing actual string comparison operations at
runtime.
ljharb added a commit that referenced this pull request Jan 11, 2016
[Performance] Optimize Map/Set fast key path
@ljharb ljharb merged commit 6d3de22 into paulmillr:master Jan 11, 2016
@ljharb
Copy link
Collaborator

ljharb commented Jan 11, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants