Number Prototype vs declared function (v142)

Revision 142 of this benchmark created on


Description

A simple Javascript benchmark comparing Number.prototype performance vs a declared function. The comparison uses a simple Javascript modulo calculation.

Setup

Number.prototype.mod = function (m) {
	return ((this % m) + m) % m;
}

function mod(n, m) {
	return ((n % m) + m) % m;
}

const n = 123;

Test runner

Ready to run.

Testing in WebKit 537.36 / undefined
TestOps/sec
Number.prototype
n.mod(26)
ready
Declared function
mod(n, 26)
ready

Revisions

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