aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-16 21:17:55 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-16 21:17:55 -0700
commit6a234e6fcea7ac015e5f77e5fe166cf64f2d5415 (patch)
treed2795c3d68db8a4dcfc707080ee4ced4109a0a03
parentdc766eb18a2b457393f7f13668d3f6640406aff4 (diff)
downloadbun-6a234e6fcea7ac015e5f77e5fe166cf64f2d5415.tar.gz
bun-6a234e6fcea7ac015e5f77e5fe166cf64f2d5415.tar.zst
bun-6a234e6fcea7ac015e5f77e5fe166cf64f2d5415.zip
Add structuredClone microbenchmark
-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();