Test calls perfs (v5)

Revision 5 of this benchmark created on


Setup

let A = 0;

function foo(a) {
	A += a
}

const FOO = Symbol()

class B {}
B.prototype.foo = foo;
B.prototype.foofoofoo = foo;
B.prototype[FOO] = foo;

let b = new B();

Test runner

Ready to run.

Testing in
TestOps/sec
Function
for(let i = 0; i < 1000; ++i)
foo(i)


console.log(A)
ready
Method call
for(let i = 0; i < 1000; ++i)
b.foo(i);
console.log(A)
ready
Method call from proto
for(let i = 0; i < 1000; ++i)
b.__proto__.foo(i);
console.log(A)
ready
Method call from proto + symbol
for(let i = 0; i < 1000; ++i)
b.__proto__[FOO](i);
console.log(A)
ready
Symbol method call
for(let i = 0; i < 1000; ++i)
b[FOO](i);
console.log(A)
ready
Long method name
for(let i = 0; i < 1000; ++i)
b.foofoofoo(i);
console.log(A)
ready

Revisions

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