aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/readfile-not-found.mjs
blob: c28100ba4a3bc98b4838c55ad5a72a20c1e8d880 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { bench, run } from "./runner.mjs";
import { readFileSync, existsSync } from "node:fs";
import { readFile } from "node:fs/promises";

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