Created
November 13, 2011 13:59
-
-
Save nhunzaker/1362133 to your computer and use it in GitHub Desktop.
Benchmarking JS
This file contains hidden or 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
// Credit: based on code by John Resig. | |
var startTime = new Date().getTime(); | |
for (var iters = 0; timeElapsed < 1000; iters++) { | |
// Run some test code here. | |
timeElapsed = new Date().getTime() - startTime; | |
} | |
// iters = number of iterations achieved in 1000 milliseconds. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment