does the jit work

Benchmark created on


Preparation HTML

<script>
  var o = {
    type: 42,
    prop1: 4,
    prop2: 5,
    prop3: 6
  }, i;
  
  var arr = ["prop1", "prop2", "prop3"];
  
  var handle1 = function(o) {
    if (o.type === 42) {
      i++;
    }
  };
  
  var handle2 = function(o) {
    if (arr.every(function(key) {
      return o[key];
    })) {
      i++;
    }
  };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
cats
i = 0;
for (var i = 0; i < 1000000; i++) {
  handle1(o);
}
 
ready
dogs
i = 0;
for (var i = 0; i < 1000000; i++) {
  handle2(o);
}
 
ready

Revisions

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