for vs every

JavaScript performance comparison

Revision 2 of this test case created by

Preparation code

<script></script>
      
<script>
Benchmark.prototype.setup = function() {
  var testArray = [];
  for(var x=0;x<10000;x++)
  {
  testArray[x]=x;
  }
  function testFunc(val,index,array)
  {
  var mul = val*val;
  }

};
</script>

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
for
for(var i=0;i<testArray.length;i++)
{
testFunc(testArray[i]);
}
pending…
every
var result = testArray.every(testFunc);
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