%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const { createBenchmark } = require('../common.js'); const { format } = require('util'); const methods = [ 'restAndSpread', 'argumentsAndApply', 'restAndApply', 'predefined', ]; const bench = createBenchmark(main, { method: methods, n: [1e6] }); function usingRestAndSpread(...args) { format(...args); } function usingRestAndApply(...args) { format.apply(null, args); } function usingArgumentsAndApply() { format.apply(null, arguments); } function usingPredefined() { format('part 1', 'part', 2, 'part 3', 'part', 4); } function main({ n, method, args }) { let fn; switch (method) { case 'restAndSpread': fn = usingRestAndSpread; break; case 'restAndApply': fn = usingRestAndApply; break; case 'argumentsAndApply': fn = usingArgumentsAndApply; break; case 'predefined': fn = usingPredefined; break; default: throw new Error(`Unexpected method "${method}"`); } bench.start(); for (let i = 0; i < n; i++) fn('part 1', 'part', 2, 'part 3', 'part', 4); bench.end(n); }