summaryrefslogtreecommitdiff
path: root/benchmark/es/spread-bench.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/es/spread-bench.js')
-rw-r--r--benchmark/es/spread-bench.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/benchmark/es/spread-bench.js b/benchmark/es/spread-bench.js
index 3c6cc93ea4..067299cd65 100644
--- a/benchmark/es/spread-bench.js
+++ b/benchmark/es/spread-bench.js
@@ -24,7 +24,6 @@ function makeTest(count, rest) {
}
function main({ millions, context, count, rest, method }) {
- const n = millions * 1e6;
const ctx = context === 'context' ? {} : null;
var fn = makeTest(count, rest);
const args = new Array(count);
@@ -37,25 +36,25 @@ function main({ millions, context, count, rest, method }) {
// Empty string falls through to next line as default, mostly for tests.
case 'apply':
bench.start();
- for (i = 0; i < n; i++)
+ for (i = 0; i < millions * 1e6; i++)
fn.apply(ctx, args);
- bench.end(n / 1e6);
+ bench.end(millions);
break;
case 'spread':
if (ctx !== null)
fn = fn.bind(ctx);
bench.start();
- for (i = 0; i < n; i++)
+ for (i = 0; i < millions * 1e6; i++)
fn(...args);
- bench.end(n / 1e6);
+ bench.end(millions);
break;
case 'call-spread':
bench.start();
- for (i = 0; i < n; i++)
+ for (i = 0; i < millions * 1e6; i++)
fn.call(ctx, ...args);
- bench.end(n / 1e6);
+ bench.end(millions);
break;
default:
- throw new Error('Unexpected method');
+ throw new Error(`Unexpected method "${method}"`);
}
}