Created
March 18, 2011 20:51
-
-
Save michaeldwan/876813 to your computer and use it in GitHub Desktop.
Revisions
-
michaeldwan created this gist
Mar 18, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ // Pass a function to profile and optionally the number of times to run function profile(test, times) { var start = new Date().getTime(); if (times === undefined) { times = 100; } for (i = 0; i < times; ++i) { test(); }; var end = new Date().getTime(); var time = end - start; print('took: ' + time); } // Example profile(function () { 1 + 2; }, 10000)