triple equals vs twice equals

JavaScript performance comparison

Revision 15 of this test case created by

Preparation code

var G_RESULT = void 0;
      
<script>
Benchmark.prototype.setup = function() {
  var testStr = 'test';
  
  var testInt     = [111,222];
  var testIntSame = [111,222];
  var testIntDiff = [112,221];
  var testIntStr  = ['111','222'];
  
  var result = true;
  var i = 0;
  var t = 0;

};

Benchmark.prototype.teardown = function() {
  G_RESULT = result;

};
</script>

Preparation code output

var G_RESULT = void 0;

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
3-equals-false
t = i%2;
result = result && (testStr[t] === testInt[t]);
i++;
pending…
2-equals-false
t = i%2;
result = result && (testStr[t] == testInt[t]);
i++;
pending…
3-equals-true
t = i%2;
result = result && (testIntStr[t] === testInt[t]);
i++;
pending…
2-equals-true
t = i%2;
result = result && (testIntStr[t] == testInt[t]);
i++
pending…
2-equals-true-non-coerced
t = i%2;
result = result && (testIntSame[t] == testInt[t]);
i++
pending…
2-equals-false-non-coerced
t = i%2;
result = result && (testIntDiff[t] == testInt[t]);
i++;
pending…
3-equals-true-non-coerced
t = i%2;
result = result && (testIntSame[t] === testInt[t]);
i++;
pending…
3-equals-false-non-coerced
t = i%2;
result = result && (testIntDiff[t] === testInt[t]);
i++;
pending…

Compare results of other browsers

Revisions

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

0 Comments

var G_RESULT = void 0;