diff options
author | 2023-01-28 23:23:26 -0800 | |
---|---|---|
committer | 2023-01-28 23:23:26 -0800 | |
commit | f087388ebc6314c2852d553f4f4ea3074369dfbe (patch) | |
tree | 935a0c205b3eccca29f3bcc5e3db18f7fdc4469d /bench/snippets/native-overhead.mjs | |
parent | 48eb0c12ab2c568d7ff706c2b0a6616d428032c8 (diff) | |
download | bun-f087388ebc6314c2852d553f4f4ea3074369dfbe.tar.gz bun-f087388ebc6314c2852d553f4f4ea3074369dfbe.tar.zst bun-f087388ebc6314c2852d553f4f4ea3074369dfbe.zip |
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>
Diffstat (limited to 'bench/snippets/native-overhead.mjs')
-rw-r--r-- | bench/snippets/native-overhead.mjs | 25 |
1 files changed, 25 insertions, 0 deletions
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(); |