Triple equals vs Double equals

JavaScript performance comparison

Revision 3 of this test case created and last updated

Info

Check performance of === against ==.

Preparation code

<script>
  var s1 = 1;
  var s2 = '1';
  var s3 = 2;
  var s4 = '2';
  var s5 = 1;
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
===
if (s1 === s2) {}
if (s1 === s3) {}
if (s1 === s4) {}
if (s1 === s5) {}
pending…
==
if (s1 == s2) {}
if (s1 == s3) {}
if (s1 == s4) {}
if (s1 == s5) {}
pending…
!==
if (s1 !== s2) {}
if (s1 !== s3) {}
if (s1 !== s4) {}
if (s1 !== s5) {}
pending…
!=
if (s1 != s2) {}
if (s1 != s3) {}
if (s1 != s4) {}
if (s1 != s5) {}
pending…
=== on same type only
if (s1 === s3) {}
if (s1 === s5) {}
if (s1 === s3) {}
if (s1 === s5) {}
pending…
== on same type only
if (s1 == s3) {}
if (s1 == s5) {}
if (s1 == s3) {}
if (s1 == s5) {}
pending…
!== on same type only
if (s1 !== s3) {}
if (s1 !== s5) {}
if (s1 !== s3) {}
if (s1 !== s5) {}
pending…
!= on same type only
if (s1 != s3) {}
if (s1 != s5) {}
if (s1 != s3) {}
if (s1 != s5) {}
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. Here’s a list of current revisions for this page:

0 comments

Add a comment