Map n=1000

JavaScript performance comparison

Test case created by hansoksendahl

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  const refMethod = methodName => (...params) => reference => reference[methodName](...params);
  
  const map = refMethod('map');
  
  function successor(x) {
      return x + 1;
  }
  
  function map1(x) {
      return x.map(x => x + 1);
  }
  
  function map2(x) {
      return x.map(successor);
  }
  
  const map3 = map(x => x + 1);
  
  const map4 = map(successor);
  
  const testArray1000 = (new Array(1000)).fill().map((_, i) => i);

};
</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
map2 n=1000
map2(testArray1000);
pending…
map3 n=1000
map3(testArray1000);
pending…
map4 n=1000
map4(testArray1000);
pending…
map1 n=1000
map1(testArray1000);
pending…

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

Compare results of other browsers

0 Comments