Created
November 5, 2012 16:36
-
-
Save mattstauffer/4018160 to your computer and use it in GitHub Desktop.
Simple Javascript snippet performance test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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