negative modulo (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script>
Number.prototype.mod = function (n) {
	return ((this % n) + n) % n;
}

function numb(m) {
    this.m = m;
}

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

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

var n = 123;
var num = new numb(123);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
modulo prototype
n.mod(26);
ready
non prototype
mmod(n, 26);
ready
custom
num.mod(26);
ready

Revisions

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