prepend args

Benchmark created by Paul Grenier on


Setup

var list = [3];
    function noop(){}

Test runner

Ready to run.

Testing in
TestOps/sec
a
(function () {
    var i, len, args = list.concat(Array.prototype.slice.call(arguments));
    for (i = 0, len = args.length; i < len; i += 1) {
       noop(args[i], i);
    }
}(2, 1));
ready
b
(function () {
    var i, len, llen;
    for (i = 0, llen = list.length, len = llen + arguments.length; i < len; i += 1) {
       noop(llen > i ? list[i] : arguments[i - llen], i);
    }
}(2, 1));
ready

Revisions

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

  • Revision 1: published by Paul Grenier on