Legotin (v49)

Revision 49 of this benchmark created on


Setup

var abs = function(value) {
    return value > 0 ? value : -value;
    }
    
    var mathAbs = Math.abs;

Test runner

Ready to run.

Testing in
TestOps/sec
first
for (var i = 0; i < 100; i++) {
abs(Math.random() - 0.5);
}
ready
second
for (var i = 0; i < 100; i++) {
mathAbs(Math.random() - 0.5);
}
ready
third
for (var i = 0; i < 100; i++) {
Math.abs(Math.random() - 0.5);
}
ready
fourth
for (var i = 0; i < 100; i++) {
var value = Math.random() - 0.5;
value > 0 ? value : -value;
}
ready

Revisions

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