-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hi, I'm willing to use the package to run benchmarks but its API is a bit unusual.
It would be convenient IMO to separate outputting logic from benchmarking with something like this:
import { bench, group, run } from 'mitata';
import { summary, lineplot, exportReport } from 'mitata/reporting'
import { setTimeout } from 'node:timers/promises';
group(() => {
bench('Sample sleep $duration', async (state) => {
const duration = state.get('duration');
for (const _sample of state) {
await setTimeout(duration);
}
}).range('duration', 1, 16, 2);
});
const results = await run({});
if(process.env.CI !== 'true'){
summary(results)
lineplot(results)
}
exportReport(results, 'benchmark.json')Having such setup would make it easy to generate reports from a dedicated environment, import it locally (with a fn like importReport) and do various visualization based on it.
I've seen #33 but the huge majority of data contained in the output are samples, which may or may not be useful to inspect afterhand.
Would you be OK with that kind of change ? Cheers !
cometkim
Metadata
Metadata
Assignees
Labels
No labels