modulo vs bitwise (v12)

Revision 12 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
modulo with comparison
for (var j = 0; j < 1000; j++) {
 if (j % 2 === 0) j = j;
}
ready
modulo with not
for (var j = 0; j < 1000; j++) {
 if (!(j % 2)) j = j;
}
ready
modulo
for (var j = 0; j < 1000; j++) {
 if (j % 2) j = j;
}
ready
bitwise with comparison
for (var j = 0; j < 1000; j++) {
 if ((j & 1) === 0) j = j;
}
ready
bitwise with not
for (var j = 0; j < 1000; j++) {
 if (!(j & 1)) j = j;
}
ready
bitwise
for (var j = 0; j < 1000; j++) {
 if (j & 1) j = j;
}
ready

Revisions

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