Files
bun.sh/bench/snippets/readfile-not-found.mjs
Michael H b54137174b Bench updates (#15029)
Co-authored-by: RiskyMH <RiskyMH@users.noreply.github.com>
2024-11-08 23:15:24 -08:00

18 lines
387 B
JavaScript

import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { bench, run } from "../runner.mjs";
bench(`readFileSync(/tmp/404-not-found)`, () => {
try {
readFileSync("/tmp/404-not-found");
} catch (e) {}
});
bench(`readFile(/tmp/404-not-found)`, async () => {
try {
await readFile("/tmp/404-not-found");
} catch (e) {}
});
await run();