JavaScript performance comparison

Test case created by Micah Smith

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Benchmark.prototype.setup = function() {
  var data = [];
  for(var i=0; i< 10000; i++){
    data.push({ sku:"sku_" + i, i1:i%10, i2: i%100, i3: i%1000, i4:i});


Preparation code output

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
find all elements of a single class 2
data.reduce(function(r,i) {
  if(i.i1 === 9 && i.i2=== 20) r.push(i);
  return r;
}, []);
find all elements of a single class
data.reduce(function(r,i) {
  if(i.i1 === 9) r.push(i);
  return r;
}, []);

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