eqeqeq vs eq

JavaScript performance comparison

Test case created

Info

Check performance of === vs == in varying situations.

Preparation code

<script>
  var u = undefined,
      i = 0,
      a = "0",
      n = null,
      e = '';
</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
u === undefined
u === undefined
pending…
u == undefined
u == undefined
pending…
typeof u === 'undefined'
typeof u === 'undefined'
pending…
typeof u == 'undefined'
typeof u == 'undefined'
pending…
i === 0
i === 0
pending…
i == 0
i == 0
pending…
i === '0'
i === '0'
pending…
i == '0'
i == '0'
pending…
a === 0
a === 0
pending…
a == 0
a == 0
pending…
a === '0'
a === '0'
pending…
a == '0'
a == '0'
pending…
n === null
n === null
pending…
n == null
n == null
pending…
n === 0
n === 0
pending…
e === ''
e === ''
pending…
e == ''
e == ''
pending…
e.length === 0
e.length === 0
pending…
e.length == 0
e.length == 0
pending…
e.length !== 0
e.length !== 0
pending…
e.length != 0
e.length != 0
pending…
e.length
if (e.length) {
 e = '';
}
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