eqeqeq vs eq (v6)

Revision 6 of this benchmark created by Mike McCaughan on


Description

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

Preparation HTML

<script>
  var e = '',
      z = '',
      isUNL = function (v) { return typeof v !== 'undefined' && v !== null && e.length !== 0; };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
e eqeqeq empty
if (e === '') {
  z = '';
}
ready
e eqeq empty
if (e == '') {
  z = '';
}
ready
e.length eqeqeq 0
if (e.length === 0) {
  z = '';
}
ready
e.length eqeq 0
if (e.length == 0) {
  z = '';
}
ready
e.length
if (e.length) {
  z = '';
}
ready
isUNL
if (isUNL(e)) {
  z = '';
}
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