From 280c45c2693546dbc915a0812e855ddda1734739 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 28 Oct 2022 18:57:33 -0700 Subject: Upgrade WebKit --- bench/snippets/array-shift.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bench/snippets/array-shift.mjs (limited to 'bench/snippets/array-shift.mjs') diff --git a/bench/snippets/array-shift.mjs b/bench/snippets/array-shift.mjs new file mode 100644 index 000000000..2b95bbc9d --- /dev/null +++ b/bench/snippets/array-shift.mjs @@ -0,0 +1,16 @@ +import { bench, run } from "mitata"; + +var myArray = new Array(5); +bench("[1, 2, 3, 4, 5].shift()", () => { + // we do this to prevent constant folding optimizations + if (myArray.length !== 5) myArray.length = 5; + myArray[0] = 1; + myArray[1] = 2; + myArray[2] = 3; + myArray[3] = 4; + myArray[4] = 5; + + myArray.shift(); +}); + +await run(); -- cgit v1.2.3