diff options
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(); |