js/commands/bench
js/commands/bench.ts
fino:commands/bench — reusable fino bench command task.
Builds the fino bench command. Positional arguments may be direct files,
directories, or glob patterns: directory-like arguments (trailing / or no
file extension) expand to descendant .bench.ts files, globs resolve from
the current working directory, and direct paths or already-canonical
specifiers pass through untouched. Every matched module is imported for its
bench() registration side effects, then execution is delegated to
fino:bench, which prints measurements to stdout.
Paths are normalized to file:// URLs before import so direct, relative,
and absolute paths all resolve through the runtime loader. Import this
module when another interface needs to mount the built-in benchmark runner
as a Task — the root Fino CLI does exactly that.
import benchCommand from 'fino:commands/bench';
// Run every benchmark under ./benchmarks, as `fino bench benchmarks/` would.
await benchCommand.parse(['benchmarks/']);
Constants
const command
The bench subcommand used by the root Fino CLI.
Requires at least one positional benchmark file. Each argument is expanded
(globs, directories) and imported for registration side effects, then
fino:bench's run() executes every registered benchmark group and prints
measurements to stdout. --filter is optional; when provided, only
benchmark groups whose full path contains the filter text are run.
Throws when no files are supplied or when expansion finds no benchmark files. In JSON output mode the command writes a summary object recording the requested files, the modules actually imported, and the active filter; the measurements themselves are always printed by the runner rather than returned.
import bench from 'fino:commands/bench';
// Equivalent to `fino bench --filter parser benchmarks/parser.bench.ts`
await bench.parse(['--filter', 'parser', 'benchmarks/parser.bench.ts']);