eqeqeq vs eq

Benchmark created on


Description

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

Preparation HTML

<script>
  var u = undefined,
      i = 0,
      a = "0",
      n = null,
      e = '';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
u === undefined
u === undefined
ready
u == undefined
u == undefined
ready
typeof u === 'undefined'
typeof u === 'undefined'
ready
typeof u == 'undefined'
typeof u == 'undefined'
ready
i === 0
i === 0
ready
i == 0
i == 0
ready
i === '0'
i === '0'
ready
i == '0'
i == '0'
ready
a === 0
a === 0
ready
a == 0
a == 0
ready
a === '0'
a === '0'
ready
a == '0'
a == '0'
ready
n === null
n === null
ready
n == null
n == null
ready
n === 0
n === 0
ready
e === ''
e === ''
ready
e == ''
e == ''
ready
e.length === 0
e.length === 0
ready
e.length == 0
e.length == 0
ready
e.length !== 0
e.length !== 0
ready
e.length != 0
e.length != 0
ready
e.length
if (e.length) {
 e = '';
}
ready

Revisions

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

  • Revision 1: published on
  • Revision 2: published on
  • Revision 3: published by Mike McCaughan on
  • Revision 4: published by Mike McCaughan on
  • Revision 5: published by Mike McCaughan on
  • Revision 6: published by Mike McCaughan on
  • Revision 7: published by Mike McCaughan on
  • Revision 8: published on