Relational Comparison To Undefined, explicit vs implicit (v3)

Revision 3 of this benchmark created on


Setup

var a = 16;
  var b = undefined;
  var c = 3;
  var d = 7;
  var e = 77;
  var f = 2;

Test runner

Ready to run.

Testing in
TestOps/sec
Negate
var result = 0;
if (! (a <= b)) {
    result += 1;
}
if (! (b <= c)) {
    result += 2;
}
if (! (c <= a)) {
    result += 4;
}

if (! (d <= e)) {
    result += 8;
}
if (! (e <= f)) {
    result += 16;
}
if (! (f <= d)) {
    result += 32;
}

return result;
ready
Check Undefined first
var result = 0;
if (a === undefined || a > b) {
    result += 1;
}
if (b === undefined || b > c) {
    result += 2;
}
if (c === undefined || c > a) {
    result += 4;
}


if (d === undefined || d > e) {
    result += 8;
}
if (e === undefined || e > f) {
    result += 16;
}
if (f === undefined || f > d) {
    result += 32;
}

return result;
ready
Check Undefined last
var result = 0;
if (a > b || a === undefined) {
    result += 1;
}
if (b > c || b === undefined) {
    result += 2;
}
if (c > a || c === undefined) {
    result += 4;
}


if (d > e || d === undefined) {
    result += 8;
}
if (e > f || e === undefined) {
    result += 16;
}
if (f > d || f === undefined) {
    result += 32;
}

return result;
ready

Revisions

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