diff options
-rw-r--r-- | bench/snippets/array-arguments-slice.mjs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bench/snippets/array-arguments-slice.mjs b/bench/snippets/array-arguments-slice.mjs new file mode 100644 index 000000000..c4f676426 --- /dev/null +++ b/bench/snippets/array-arguments-slice.mjs @@ -0,0 +1,12 @@ +import { bench, run } from "mitata"; + +function doIt(...args) { + // we use .at() to prevent constant folding optimizations + return args.slice().at(0); +} + +bench("Array.prototype.slice.call(arguments)", () => { + return doIt(1, 2, 3, 4, 5, 6); +}); + +await run(); |