Skip to content

Instantly share code, notes, and snippets.

@juniorbird
Last active March 9, 2016 18:05
Show Gist options
  • Save juniorbird/4d025d4a9ed03e0fea10 to your computer and use it in GitHub Desktop.
Save juniorbird/4d025d4a9ed03e0fea10 to your computer and use it in GitHub Desktop.
All my JSPerfs

My JSPerfs

Sometimes, I want to know what's fast. Usually I google it. But, in the below cases, I decided I needed to try it myself.

  • Fastest Factorial - what's the cost of doing it recursively? Turns out While is 10x faster.
  • Fastest way to find type - instanceof seems good. JQuery uses constructor. Prototype.toString is probably the most safe and compatible.
  • Speed of Sorts, when written as recursive or using a while loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment