forEach this and bind

JavaScript performance comparison

Test case created by John Hu

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var test = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  var fakeContext = {};

};
</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
forEach with second argument
test.forEach(function(d) {
  // do nothing
}, fakeContext);
pending…
bind
test.forEach(function(d) {
  // do nothing
}.bind(fakeContext));
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