v8/test/js-perf-test/RestParameters
bmeurer 07e163bd5a [js-perf-test] Add microbenchmarks for materialized rest parameters.
Functions that take mandatory parameters plus a number of optional
parameters, that need to be materialized as an Array are quite common.
The simplest possible case of this is essentially:

  function foo(mandatory, ...args) { return args; }

Babel translates this to something like:

  function foo(mandatory) {
    "use strict";
    for (var _len = arguments.length,
             args = Array(_len > 1 ? _len - 1 : 0),
             _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }
    return args;
  }

The key to great performance here is to make sure that we don't
materialize the (unmapped) arguments object in this case, plus that we
have some kind of fast-path for the Array constructor and the
initialization loop.

This microbenchmark ensures that we have decent performance even in the
case where the assignment to args is polymorphic, i.e. the arguments
have seen different elements kinds, starting with FAST_HOLEY_ELEMENTS
and then FAST_HOLEY_SMI_ELEMENTS.

R=yangguo@chromium.org
BUG=v8:6262

Review-Url: https://codereview.chromium.org/2823343004
Cr-Commit-Position: refs/heads/master@{#44709}
2017-04-19 05:25:40 +00:00
..
rest.js [js-perf-test] Add microbenchmarks for materialized rest parameters. 2017-04-19 05:25:40 +00:00
run.js [es6] add js-perf-test for rest parameters 2015-09-08 23:17:11 +00:00