Function calling overhead

Benchmark publishedon

Setup

const max = 1000000000;
let t = 0;

Test Runner

Initializing...

Testing in
Test CaseOps/sec
No function
for( let i = 0; i < max; i++ ) {
	t=i + i - 1;
}
ready
normal function
function a( b, c ) {
	return b + c;
}

for( let i = 0; i < max; i++ ) {
	t=a( i, i - 1 );
}
ready
Inline function
const a = ( b, c ) => {
	return b + c;
}

for( let i = 0; i < max; i++ ) {
	t=a( i, i - 1 );
}
ready
Anonymous function
const a = function( b, c ) {
	return b + c;
}

for( let i = 0; i < max; i++ ) {
	t=a( i, i - 1 );
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

Revision 1
publishedon