Triple equals vs Double equals (v3)

Revision 3 of this benchmark created on


Description

Check performance of === against ==.

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
===
if (s1 === s2) {}
if (s1 === s3) {}
if (s1 === s4) {}
if (s1 === s5) {}
ready
==
if (s1 == s2) {}
if (s1 == s3) {}
if (s1 == s4) {}
if (s1 == s5) {}
ready
!==
if (s1 !== s2) {}
if (s1 !== s3) {}
if (s1 !== s4) {}
if (s1 !== s5) {}
ready
!=
if (s1 != s2) {}
if (s1 != s3) {}
if (s1 != s4) {}
if (s1 != s5) {}
ready
=== on same type only
if (s1 === s3) {}
if (s1 === s5) {}
if (s1 === s3) {}
if (s1 === s5) {}
ready
== on same type only
if (s1 == s3) {}
if (s1 == s5) {}
if (s1 == s3) {}
if (s1 == s5) {}
ready
!== on same type only
if (s1 !== s3) {}
if (s1 !== s5) {}
if (s1 !== s3) {}
if (s1 !== s5) {}
ready
!= on same type only
if (s1 != s3) {}
if (s1 != s5) {}
if (s1 != s3) {}
if (s1 != s5) {}
ready

Revisions

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