Created
May 6, 2013 02:08
-
-
Save hushin/5523006 to your computer and use it in GitHub Desktop.
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
xjsfl.init(this); // init xJSFL | |
;(function(){ | |
function scriptFolderURI() { | |
return fl.scriptURI.replace(/[¥/][^¥/]*?$/,"/"); | |
} | |
// use Lo-Dash | |
fl.runScript(scriptFolderURI() + "jsload/lib/lodash.compat.js"); | |
})(); | |
function benchmark(name, times, callback){ | |
var timer = new Timer(name); | |
timer.start(); | |
for (var i=0; i < times; i++){ | |
callback(); | |
} | |
timer.stop(true); | |
} | |
clear(); | |
benchmark("benchmark test", 1000,function(){ | |
// task | |
_.reduce(_.range(100), function (sum, num) {return sum + num;}); | |
}); | |
benchmark("benchmark test2", 1000,function(){ | |
// task | |
_.map(_.range(100), function (item) {return item * item * item;}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment