Skip to content

Instantly share code, notes, and snippets.

@mattstauffer
Created November 5, 2012 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattstauffer/4018160 to your computer and use it in GitHub Desktop.
Save mattstauffer/4018160 to your computer and use it in GitHub Desktop.
Simple Javascript snippet performance test
// Simple Perf test on javascript snippets ( from http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/ )
var totalTime,
start = new Date,
iterations = 1000;
while (iterations--) {
// Code snippet goes here
}
// totalTime → the number of milliseconds taken
// to execute the code snippet 1000 times
totalTime = new Date - start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment