foreach call vs prototype-call

Benchmark created by Paul O’Shannessy on


Setup

var callbacks = [];
    for (var i = 0; i < 10; i++) {
      callbacks.push(function() { });
    }

Test runner

Ready to run.

Testing in
TestOps/sec
basic
callbacks.forEach(function(cb) {
  cb();
});
ready
Function.prototype.call
callbacks.forEach(Function.prototype.call, Function.prototype.call);
ready

Revisions

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