aboutsummaryrefslogtreecommitdiff
path: root/bench/ffi/node.mjs
blob: 8c2d069717278ffe6ada4c8375638cae8d83fd66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { run, bench, group } from "mitata";
import { createRequire } from "node:module";

const require = createRequire(import.meta.url);
const { napiNoop, napiHash, napiString } = require("./src/ffi_napi_bench.node");

const bytes = new Uint8Array(64);

group("napi", () => {
  bench("noop", () => napiNoop());
  bench("hash", () => napiHash(bytes));

  bench("string", () => napiString());
});

await run();