diff options
author | 2022-11-02 20:46:24 -0700 | |
---|---|---|
committer | 2022-11-02 20:46:24 -0700 | |
commit | 34e130a3e0cb251cb163071b75228c6d521edf95 (patch) | |
tree | 1669cee5f99fa0395950296a924f29517ac5b5ca /bench/snippets/array-arguments-slice.mjs | |
parent | 09434f1486035c60016ded1359189dfdeed72e5d (diff) | |
download | bun-34e130a3e0cb251cb163071b75228c6d521edf95.tar.gz bun-34e130a3e0cb251cb163071b75228c6d521edf95.tar.zst bun-34e130a3e0cb251cb163071b75228c6d521edf95.zip |
Add a misc snippet
Diffstat (limited to 'bench/snippets/array-arguments-slice.mjs')
-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(); |