Skip to content

Instantly share code, notes, and snippets.

@hushin
Created May 6, 2013 02:08
Show Gist options
  • Save hushin/5523006 to your computer and use it in GitHub Desktop.
Save hushin/5523006 to your computer and use it in GitHub Desktop.
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