From f087388ebc6314c2852d553f4f4ea3074369dfbe Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sat, 28 Jan 2023 23:23:26 -0800 Subject: Support running WASI (WebAssembly) files using `bun run` (#1929) * another micro bench * Support running WASI --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- bench/snippets/native-overhead.mjs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bench/snippets/native-overhead.mjs (limited to 'bench/snippets') diff --git a/bench/snippets/native-overhead.mjs b/bench/snippets/native-overhead.mjs new file mode 100644 index 000000000..2a8dbd623 --- /dev/null +++ b/bench/snippets/native-overhead.mjs @@ -0,0 +1,25 @@ +import { bench, run } from "mitata"; + +// These are no-op C++ functions that are exported to JS. +const lazy = globalThis[Symbol.for("Bun.lazy")]; +const noop = lazy("noop"); +const fn = noop.function; +const regular = noop.functionRegular; + +bench("C++ fn regular", () => { + regular(); +}); + +bench("C++ fn", () => { + fn(); +}); + +bench("C++ getter", () => { + return noop.getterSetter; +}); + +bench("C++ setter", () => { + noop.getterSetter = 1; +}); + +run(); -- cgit v1.2.3