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

23 lines
490 B
JavaScript

import { posix } from "path";
import { bench, run } from "../runner.mjs";
const pathConfigurations = [
"",
".",
"./",
["", ""].join("|"),
["./abc.js"].join("|"),
["foo/bar", "/tmp/file/", "..", "a/../subfile"].join("|"),
["a/b/c/", "../../.."].join("|"),
];
pathConfigurations.forEach(paths => {
const args = paths.split("|");
bench(`resolve(${args.map(a => JSON.stringify(a)).join(", ")})`, () => {
globalThis.abc = posix.resolve(...args);
});
});
await run();