Added WithProcessStabilization to pin CPU affinity and raise process priority for all BDN entry points, matching Console runner stabilization. Benchmark results are now ordered by Engine then RtPerOp for stable, diff-friendly output. Report headers clarify when BDN manages run parameters. Enhanced comments for clarity; no changes to benchmark logic. |
||
|---|---|---|
| .. | ||
| BenchmarkReportWriter.cs | ||
| BenchmarkResult.cs | ||
| README.md | ||
| ReportingContext.cs | ||
README.md
Reporting
Shared reporting types — the BenchmarkResult DTO that captures one cell of a benchmark run + the BenchmarkReportWriter that turns a list of these into the unified .log / .LLM / .output triplet + the ReportingContext bundle that parameterises both runners.
Layout
-
BenchmarkResult.cs— per-cell result row.(TestData × Engine × IoMode × OptionsPreset × DispatchMode)tuple + Ser / Des / RT timings (median, min, max, stddev — all ms-batch units), iter counts (post-calibration), allocated bytes per op, setup-side one-time alloc,IsRoundTripOnlyflag, derivedSerializerName. Pure DTO — no behaviour. Populated by either:- Console
BenchmarkLoop.RunBenchmarksForTestData(after adaptive measurement) - BDN
BdnSummaryAdapter.Translate(after BDN Summary is in hand)
- Console
-
ReportingContext.cs— record bundle for the writer:SourceTag—"Console"/"Bdn"; drives the filename prefixResultsDirectory— resolved at startup viaResolveResultsDirectory()walking up fromAppContext.BaseDirectoryto the nearestAyCode.Core.sln, thenTest_Benchmark_Results/Benchmark/. Worktree-aware.BuildConfiguration—"Debug"/"Release"/"NativeAOT"; rendered into both the filename AND the report headerUtf8NoBom— sharedUTF8Encoding(false)for allFile.WriteAllTextcallsCharsetName,WarmupIterations,BenchmarkSamples,TargetSampleMs,UnstableCVThreshold— run-header info embedded in every emitted artifact
-
BenchmarkReportWriter.cs— the writer itself:SaveAll(ctx, results, testDataSets)— orchestrator. Writes the.log(formatted text + CSV + per-cell tables + Overall aggregation),.LLM(markdown table + Overall aggregation), and.output(hex dump of the Large cell's AcBinary serialization). All three land inctx.ResultsDirectorywith the{ctx.SourceTag}.FullBenchmark_{Build}_{ts}.<ext>filename pattern.PrintGroupedResults(results, testDataSets)— colored per-cell tables toSystem.Console. Highlights MemoryPack (baseline) and AcBinary (SGen-Byte[]) rows with green/red win/lose colors, footer row shows pct deltas per metric.PrintResult(result)— single-line summary printed during the per-cell loop (real-time progress signal).ComputeOverallStats(acResults, mpResults, valueSelector)— paired-cell aggregation acrossTestDataName(arithmetic mean / geometric mean / median of per-cell ratios). Null-safe.FormatMicrosWithRange(...)—26.86 (24.50..29.10)style with ⚠️CV-warning suffix when stddev/median exceeds theUnstableCVThreshold. All formatting goes throughCultureInfo.InvariantCultureso the CSV section in.logstays parseable regardless of the host locale.ToPerOpMicros/SerPerOp/DesPerOp/RtPerOp/ToKilobytes/FormatPctSigned/FormatHexDump/AppendOverallLine— helper utilities used inline by the report-rendering methods.
Conventions
- Time units in
BenchmarkResult: all*TimeMsfields are total-batch milliseconds. Per-op µs =TimeMs / Iterations * 1000. For BDN-sourced rows the adapter storesMean_ns / 1e6withIterations = 1, so the same formula yields per-op µs directly (ms * 1000 = µs). - InvariantCulture is enforced everywhere a numeric value is rendered to file (
.logCSV section,.LLMmarkdown cells). Console-output (the colored tables) uses default culture for human-friendliness. SourceTagdiscriminator: appears in three places — the filename prefix (Console./Bdn.), the.logheader (║ Source: Console), the.LLMH1 (# AcBinary Benchmark [Console] Release ...). Anyone diffing or grepping outputs can pin the source unambiguously.