You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1.0 KiB

/*
* Basic function call performance.
*/
if (typeof print !== 'function') { print = console.log; }
function func() {
return;
}
function test() {
var i;
var f = func; // eliminate slow path lookup from results
var t1 = Date.now();
for (i = 0; i < 1e6; i++) {
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
f(); f(); f(); f(); f(); f(); f(); f(); f(); f();
}
var t2 = Date.now();
print((1e6 * 100 / (t2 - t1)) + ' calls per millisecond');
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}