Add shell-spawn microbenchmark

This commit is contained in:
Jarred Sumner
2024-01-22 03:23:47 -08:00
parent 6019665d4b
commit eaa1cd5553
3 changed files with 41 additions and 1 deletions

Binary file not shown.

View File

@@ -8,10 +8,12 @@
"braces": "^3.0.2",
"esbuild": "^0.14.12",
"eventemitter3": "^5.0.0",
"execa": "^8.0.1",
"fast-glob": "3.3.1",
"fdir": "^6.1.0",
"mitata": "^0.1.6",
"string-width": "^7.0.0"
"string-width": "^7.0.0",
"zx": "^7.2.3"
},
"scripts": {
"ffi": "cd ffi && bun run deps && bun run build && bun run bench",

View File

@@ -0,0 +1,38 @@
import { $ as zx } from "zx";
import { $ as execa$ } from "execa";
import { bench, run, group } from "./runner.mjs";
const execa = execa$({ stdio: "ignore", cwd: import.meta.dirname });
group("echo hi", () => {
if (typeof Bun !== "undefined")
bench("$`echo hi`", async () => {
await Bun.$`echo hi`.quiet();
});
bench("execa`echo hi`", async () => {
await execa`echo hi`;
});
bench("zx`echo hi`", async () => {
await zx`echo hi`.quiet();
});
});
group("ls .", () => {
if (typeof Bun !== "undefined")
bench("$`ls .`", async () => {
await Bun.$`ls .`.quiet();
});
bench("execa`ls .`", async () => {
await execa`ls .`;
});
bench("zx`ls .`", async () => {
await zx`ls .`.quiet();
});
});
await run();