Average multi microbenchmarks results#5215
Draft
VincentBu wants to merge 22 commits intodotnet:mainfrom
Draft
Conversation
…ks when creating suites
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the GC microbenchmark infrastructure to support aggregating (averaging) results across multiple microbenchmark runs/iterations, while also renaming/refactoring parts of the analysis/presentation pipeline and introducing an outlier-removal helper.
Changes:
- Add configurable microbenchmark iteration count (
iterations) and wire it into suite creation and execution. - Replace the previous single-result comparison flow with a new per-benchmark aggregation/comparison pipeline (
MicrobenchmarkResultComparison,GCTraceMetrics,GCTraceMetricComparisonResult). - Refactor output generation to primarily emit JSON (markdown generation currently disabled).
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/RunCommand/CreateSuiteCommand.cs | Reads configured iteration count and applies it to microbenchmark suite environment. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/RunCommand/BaseSuite/MicrobenchmarksToRun.txt | Updates baseline suite benchmark list. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/RunCommand/BaseSuite/Microbenchmarks.yaml | Renames environment iteration setting to iterations. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/Microbenchmark/MicrobenchmarkCommand.cs | Runs microbenchmarks for iterations and switches to new aggregation/comparison logic before presenting results. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/Microbenchmark/MicrobenchmarkAnalyzeCommand.cs | Updates analysis-only command to use the new aggregation/comparison logic. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Presentation/Microbenchmarks/Presentation.cs | Changes presentation API to accept precomputed grouped results; markdown output path currently disabled. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Presentation/Microbenchmarks/Markdown.cs | Markdown generation code is commented out. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Presentation/Microbenchmarks/Json/JsonOutput.cs | Removes unused placeholder type. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Presentation/Microbenchmarks/Json.cs | Moves JSON generator to Microbenchmarks presentation namespace and updates signature for grouped results. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Configurations/Microbenchmarks.Configuration.cs | Renames iteration to iterations in microbenchmark environment configuration. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Configurations/InputConfiguration.cs | Adds iterations map to input configuration. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/Microbenchmarks/MicrobenchmarkResultsAnalyzer.cs | Removes old analyzer/comparison pipeline. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/Microbenchmarks/MicrobenchmarkResultComparison.cs | Adds new JSON/trace mapping, per-benchmark analysis, and aggregation/grouping logic. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/Microbenchmarks/MicrobenchmarkResult.cs | Introduces new MicrobenchmarkResult model (namespace currently mismatched vs usage). |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/Microbenchmarks/MicrobenchmarkComparisonResult.cs | Updates comparison to support averaged values/outlier removal and new trace-metric comparisons. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/GCTraceMetrics.cs | Adds trace-derived metric extraction (includes reflection/stat bugs). |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/GCTraceMetricComparisonResult.cs | Adds averaged comparison for trace metrics (baseline vs comparand). |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/GCTraceMetricComparison.cs | Adds helper wrapper for metric comparison construction. |
| src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/BdnJsonResult.cs | Refactors BDN JSON model types; renames top-level to BdnJsonResult. |
| src/benchmarks/gc/GC.Infrastructure/GC.Analysis.API/Statistics.cs | Adds RemoveOutliers helper (IQR method). |
| src/benchmarks/gc/GC.Infrastructure/Configurations/Run.yaml | Adds iteration configuration block (currently mismatched with new iterations input model). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
VincentBu
commented
May 1, 2026
VincentBu
commented
May 1, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…chmarks namespace
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| // Set iterations if they exist. | ||
| if (inputConfiguration.iterations != null) | ||
| { | ||
| configuration.Environment.iterations = inputConfiguration.iterations.GetValueOrDefault<string, uint>("microbenchmarks", 1); |
Comment on lines
+64
to
+83
| if (property.PropertyType != typeof(double) || property.PropertyType != typeof(int)) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| string propertyName = property.Name; | ||
| double propertyValue = (double)(property.GetValue(processData.Stats) ?? double.NaN); | ||
| StatsData[propertyName] = propertyValue; | ||
| } | ||
|
|
||
| var fields = processData.Stats.GetType().GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); | ||
| foreach (var field in fields) | ||
| { | ||
| if (field.FieldType != typeof(double) || field.FieldType != typeof(int)) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| string name = field.Name; | ||
| double value = (double)(field.GetValue(processData.Stats) ?? double.NaN); |
…om/VincentBu/performance into average-microbenchmarks-iterations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims at calculating average value of multiple microbenchmarks results. The work revolves around: