eqeqeq vs eq

JavaScript performance comparison

Revision 2 of this 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
if (u === undefined) {
 e = '';
}
pending…
u == undefined
if (u == undefined) {
 e = '';
}
pending…
typeof u === 'undefined'
if (typeof u === 'undefined') {
 e = '';
}
pending…
typeof u == 'undefined'
if (typeof u == 'undefined') {
 e = '';
}
pending…
i === 0
if (i === 0) {
 e = '';
}
pending…
i == 0
if (i == 0) {
 e = '';
}
pending…
i === '0'
if (i === '0') {
 e = '';
}
pending…
i == '0'
if (i == '0') {
 e = '';
}
pending…
a === 0
if (a === 0) {
 e = '';
}
pending…
a == 0
if (a == 0) {
 e = '';
}
pending…
a === '0'
if (a === '0') {
 e = '';
}
pending…
a == '0'
if (a == '0') {
 e = '';
}
pending…
n === null
if (n === null) {
 e = '';
}
pending…
n == null
if (n == null) {
 e = '';
}
pending…
n === 0
if (n === 0) {
 e = '';
}
pending…
e === ''
if (e === '') {
 e = '';
}
pending…
e == ''
if (e == '') {
 e = '';
}
pending…
e.length === 0
if (e.length === 0) {
 e = '';
}
pending…
e.length == 0
if (e.length == 0) {
 e = '';
}
pending…
e.length !== 0
if (e.length !== 0) {
 e = '';
}
pending…
e.length != 0
if (e.length != 0) {
 e = '';
}
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