diff options
Diffstat (limited to 'bench/ffi/plus100/add3.bun.js')
-rw-r--r-- | bench/ffi/plus100/add3.bun.js | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/bench/ffi/plus100/add3.bun.js b/bench/ffi/plus100/add3.bun.js deleted file mode 100644 index 4e79d4cea..000000000 --- a/bench/ffi/plus100/add3.bun.js +++ /dev/null @@ -1,49 +0,0 @@ -import { run, bench, group, baseline } from "mitata"; -import { dlopen, suffix } from "bun:ffi"; -import { readdirSync } from "fs"; - -const { - symbols: { - add3: { native: add3 }, - noop, - }, - close, -} = dlopen(`./plus100.dylib`, { - add3: { - args: ["int32_t", "int32_t", "int32_t"], - returns: "int32_t", - }, - noop: { - args: [], - }, -}); -const { add3: add3napi, noop: noopNapi } = require("./plus100-napi/index.js"); - -group("add3", () => { - bench("add3(1,2,3) ffi", () => { - add3(1, 2, 3); - }); - - bench("add3(1,2,3) napi", () => { - add3napi(1, 2, 3); - }); -}); - -group("noop", () => { - bench("noop() ffi", () => { - noop(); - }); - - bench("noop() napi", () => { - noopNapi(); - }); -}); - -// collect option collects benchmark returned values into array -// prevents gc and can help with jit optimizing out functions -await run({ collect: false, percentiles: true }); -console.log("\n"); - -if (add3(1, 2, 3) !== 1 + 2 + 3) { - throw new Error("add3(1) !== 101"); -} |