add Ox.time

This commit is contained in:
rolux 2013-11-29 21:09:33 +01:00
parent ef07c50fff
commit 420dd7f266

View file

@ -147,3 +147,13 @@ Ox.queue = function(fn, maxThreads) {
} }
return ret; return ret;
}; };
/*@
Ox.time <f> Returns the time it takes to execute a given function
(fn) -> <n> Time in milliseconds
@*/
Ox.time = function(fn) {
var time = new Date;
fn();
return new Date() - time;
};