Skip to content

Conversation

laquasicinque
Copy link
Contributor

@laquasicinque laquasicinque commented Oct 5, 2019

Changed from using a switch statement to using an object map, which might be (slightly) faster.

@thecrypticace
Copy link
Contributor

thecrypticace commented Oct 5, 2019

I would definitely challenge the idea that an object map is faster than a switch. Compiler's often generate jump tables for switch statements with constant cases. Object maps require indirection through a hash table. The switch is almost certainly faster especially if this ends up being a hot code path.

@laquasicinque
Copy link
Contributor Author

This is true, it definitely used to always be the case where object maps were faster for large switch statements not sure these days.

@yyx990803
Copy link
Member

Pretty sure switch is faster because it's more optimizable for JS engines.

@yyx990803 yyx990803 closed this Oct 5, 2019
@laquasicinque laquasicinque deleted the component-proxy-refactor-switch branch October 5, 2019 20:35
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.

3 participants