Skip to content

Instantly share code, notes, and snippets.

@quells
Created September 14, 2017 17:35
Show Gist options
  • Save quells/95e7ed235abd98dae64a2cef0ea16b0a to your computer and use it in GitHub Desktop.
Save quells/95e7ed235abd98dae64a2cef0ea16b0a to your computer and use it in GitHub Desktop.
Javascript Performance Notes
2.4 ns per bit shift
6.3 ns per multiply by 2
25 ns per == comparison
2 ns per === comparison
45 ns per parseInt
2 ns per Math.floor
// both work as array indices
32 ns per indexOf (scales with length of array)
2 ns per object property lookup (does not scale with number of entries)
// memory use characteristics not investigated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment