Files
bun.sh/bench/snippets/native-overhead.mjs
Jarred Sumner 912a2cbc12 Expose some no-ops (#16125)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2025-01-03 13:57:46 -08:00

25 lines
457 B
JavaScript

import { noOpForTesting as noop } from "bun:internal-for-testing";
import { bench, run } from "../runner.mjs";
// These are no-op C++ functions that are exported to JS.
const fn = noop.function;
const callback = noop.callback;
bench("C++ callback into JS", () => {
callback(() => {});
});
bench("C++ fn", () => {
fn();
});
bench("C++ getter", () => {
return noop.getterSetter;
});
bench("C++ setter", () => {
noop.getterSetter = 1;
});
run();