equal vs strict equal

JavaScript performance comparison

Revision 2 of this test case created by allex_wang

Preparation code

	var IGNORE_TAGS = 'INPUT SELECT STYLE NOSCRIPT SCRIPT'.split(' '),
		inArray = function (what, arr) {
			var l = arr.length;
			while (l--) {
				if (arr[l] === what) return true;
			}
			return false;
		},
MAP = {INPUT:1, SELECT:1, STYLE:1, NOSCRIPT:1, SCRIPT:1};


<script>
  var IGNORE_TAGS = 'INPUT SELECT STYLE NOSCRIPT SCRIPT'.split(' '),
      inArray = function(what, arr) {
    var l = arr.length;
    while (l--) {
     if (arr[l] === what) return true;
    }
    return false;
      },
      MAP = {
    INPUT: 1,
    SELECT: 1,
    STYLE: 1,
    NOSCRIPT: 1,
    SCRIPT: 1
      };
</script>
    

Preparation code output

var IGNORE_TAGS = 'INPUT SELECT STYLE NOSCRIPT SCRIPT'.split(' '), inArray = function (what, arr) { var l = arr.length; while (l--) { if (arr[l] === what) return true; } return false; }, MAP = {INPUT:1, SELECT:1, STYLE:1, NOSCRIPT:1, SCRIPT:1};

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
inArray('SCRIPT', IGNORE_TAGS)
!! inArray('SCRIPT', IGNORE_TAGS)
pending…
!!MAP['SCRIPT']
!! MAP['SCRIPT']
pending…
'SCRIPT' in MAP
!! ('SCRIPT' in MAP)
pending…
=== '0'
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.

0 Comments

var IGNORE_TAGS = 'INPUT SELECT STYLE NOSCRIPT SCRIPT'.split(' '), inArray = function (what, arr) { var l = arr.length; while (l--) { if (arr[l] === what) return true; } return false; }, MAP = {INPUT:1, SELECT:1, STYLE:1, NOSCRIPT:1, SCRIPT:1};