aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/structuredClone.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'bench/snippets/structuredClone.mjs')
-rw-r--r--bench/snippets/structuredClone.mjs39
1 files changed, 39 insertions, 0 deletions
diff --git a/bench/snippets/structuredClone.mjs b/bench/snippets/structuredClone.mjs
new file mode 100644
index 000000000..3007b22f5
--- /dev/null
+++ b/bench/snippets/structuredClone.mjs
@@ -0,0 +1,39 @@
+var testArray = [
+ {
+ description: "Random description.",
+ testNumber: 123456789,
+ testBoolean: true,
+ testObject: {
+ testString: "test string",
+ testNumber: 12345,
+ },
+ testArray: [
+ {
+ myName: "test name",
+ myNumber: 123245,
+ },
+ ],
+ },
+ {
+ description: "Random description.",
+ testNumber: 123456789,
+ testBoolean: true,
+ testObject: {
+ testString: "test string",
+ testNumber: 12345,
+ },
+ testArray: [
+ {
+ myName: "test name",
+ myNumber: 123245,
+ },
+ ],
+ },
+];
+
+import { bench, run } from "./runner.mjs";
+
+bench("structuredClone(array)", () => structuredClone(testArray));
+bench("structuredClone(123)", () => structuredClone(123));
+bench("structuredClone({a: 123})", () => structuredClone({ a: 123 }));
+await run();