microbench 0.2.0
microbench: ^0.2.0 copied to clipboard
Zero-dependency microbenchmark harness for Dart: robust timing, comparison tables in Markdown, HTML or text, JSON output, and README embedding.
0.2.0 #
- Breaking Changes: text tables mark noise with
(≈ same)and end with warnings; Markdown and HTML cells may end with≈;MeasurementJSON gainssampleMicros; comparisons measure their rows in alternating rounds, so timings shift slightly from 0.1.0. compareandmatrix: comparison tables from maps of closures, sync or async.package:microbench/suite.dart:benchmark()andgroup(), declared likepackage:testand run automatically.runMain(args, body):--quick,--thorough,--filter,--format,--out,--verify,--save,--baselineand--thresholdfor any benchmark program, through zone-scopedBenchmarkSettings.- Rows of a column are measured in alternating rounds (A B B A);
BenchmarkOptions.roundsandBenchmarkOptions.thorough.measureAllmeasures a list of benchmarks this way. - Significance:
Measurementkeeps its samples (sampleMicros,meanMicros,stdDevMicros,cv); cells whose difference fails a Mann-Whitney U test (mannWhitneyP,runComparison(alpha:)) are marked≈, also inmeasureDiff. - Warnings below tables for runs under 1 ns and times that do not grow with
the input size (
Comparison.warnings,showWarnings:). verify:oncompare,matrix,runComparison,measureAllandmeasureDiffchecks that rows return equal results (deepEquals), throwingOutputMismatchError.JsonTableRenderer,Comparison.fromJson,parseComparisons,Metric.byName, andBenchmarkDiffwithChangeKindfor regression checks.- Tables record their
environment(detectRuntime(),currentEnvironment()). dart run microbench runcompiles and runs benchmarks onjit,aot,jsandwasm(runBenchmarks,planRun,findBenchmarks), anddart run microbench diffcompares saved results.- Guides: getting trustworthy numbers, and migrating from
benchmark_harness. - Bars no longer fail when a run is faster than the clock resolution, and
infinite values format as
Infinity.
0.1.0 #
- Initial release, extracted from the benchmark harness shared by hashlib, cipherlib and convertlib.
SyncBenchmark,AsyncBenchmarkandSkippedBenchmark, withSyncBenchmark.fromandAsyncBenchmark.fromfor closures.BenchmarkOptionsfor warmup, duration and batch sizing.Measurementwith median, best, worst and median absolute deviation, and JSON support.Metric.throughput,Metric.rate,Metric.runtimeandMetric.perSecond.runComparisonandComparison, rendered byMarkdownTableRenderer,HtmlTableRendererandTextTableRenderer, or serialized withtoJson.package:microbench/io.dart:ReportFile,embedFile,compileAndRunandenvironmentSummary.- Executables
microbench:embedandmicrobench:exe.