Skip to content

perf: include every pattern in benchmark matrix#334

Merged
JerrettDavis merged 1 commit into
mainfrom
benchmarkdotnet-complete-pattern-matrix
May 23, 2026
Merged

perf: include every pattern in benchmark matrix#334
JerrettDavis merged 1 commit into
mainfrom
benchmarkdotnet-complete-pattern-matrix

Conversation

@JerrettDavis
Copy link
Copy Markdown
Owner

Summary\n- add BenchmarkDotNet coverage matrix benchmarks for every PatternKit production catalog pattern\n- include fluent construction, fluent execution, generated construction, and generated execution routes for each catalog pattern\n- add generator matrix benchmarks that enumerate every *Generator.cs source file\n- add TinyBDD production-readiness tests that fail when catalog patterns or generator sources are missing from the benchmark matrix\n- update benchmark docs to describe the complete matrix\n\n## Validation\n- dotnet restore benchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj\n- dotnet restore test/PatternKit.Examples.Tests/PatternKit.Examples.Tests.csproj\n- git diff --check\n\nLocal test/build is still blocked by the known Windows Roslyn analyzer/compiler mismatch in PatternKit.Examples; PR CI is the authoritative generator-backed validation.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

Test Results

    1 files      1 suites   2m 2s ⏱️
1 003 tests 1 003 ✅ 0 💤 0 ❌
1 008 runs  1 008 ✅ 0 💤 0 ❌

Results for commit 6d19507.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the benchmark suite to include a complete “coverage matrix” that enumerates (a) every production-readiness catalog pattern and (b) every *Generator.cs source file, and adds production-readiness tests + docs updates to keep that matrix complete over time.

Changes:

  • Added BenchmarkDotNet “matrix” benchmarks for pattern coverage and generator source coverage.
  • Added TinyBDD production-readiness tests that validate the benchmark coverage inventories against the pattern catalog and generator source tree.
  • Updated benchmark documentation and adjusted the benchmarks project to multi-target net8.0;net9.0;net10.0.

Reviewed changes

Copilot reviewed 7 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs Adds production-readiness tests asserting benchmark coverage for catalog patterns and generator sources.
test/PatternKit.Examples.Tests/PatternKit.Examples.Tests.csproj Links benchmark coverage source files into the test project for validation.
docs/guides/benchmarks.md Documents the new full coverage matrix and its test-backed enforcement.
benchmarks/PatternKit.Benchmarks/README.md Clarifies expectations for pattern-specific scenario benchmarks vs. coverage matrix benchmarks.
benchmarks/PatternKit.Benchmarks/PatternKitBenchmarkConfig.cs Renames the BenchmarkDotNet job id to reflect “current” TFM execution.
benchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj Multi-targets benchmarks across net8/net9/net10 and references PatternKit.Examples for catalog-driven coverage.
benchmarks/PatternKit.Benchmarks/packages.lock.json Updates lock file to reflect new targeting/dependency graph.
benchmarks/PatternKit.Benchmarks/Coverage/PatternMatrixBenchmarks.cs Adds BenchmarkDotNet coverage benchmarks for fluent/generated construction/execution routes.
benchmarks/PatternKit.Benchmarks/Coverage/PatternBenchmarkCoverage.cs Introduces catalog-driven route enumeration for pattern benchmark coverage.
benchmarks/PatternKit.Benchmarks/Coverage/GeneratorMatrixBenchmarks.cs Adds BenchmarkDotNet coverage benchmarks enumerating generator source files.
benchmarks/PatternKit.Benchmarks/Coverage/GeneratorBenchmarkCoverage.cs Introduces generator-source enumeration used by generator coverage benchmarks.
benchmarks/PatternKit.Benchmarks/Coverage/BenchmarkRoute.cs Defines route/phase enums and route record types used by coverage matrix benchmarks.
benchmarks/PatternKit.Benchmarks/Coverage/BenchmarkRepository.cs Adds repo-root discovery helper (via PatternKit.slnx) for benchmarks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

implementation.ExampleDocumentationPath));
}

return routes;
Comment on lines 14 to 17
public static IConfig Create()
=> ManualConfig.Create(DefaultConfig.Instance)
.AddJob(Job.Default.WithId("net10.0"))
.AddJob(Job.Default.WithId("current-tfm"))
.AddDiagnoser(MemoryDiagnoser.Default)
Comment on lines +74 to +86
private static string FindRepoRoot()
{
var directory = new DirectoryInfo(AppContext.BaseDirectory);
while (directory is not null)
{
if (File.Exists(Path.Combine(directory.FullName, "PatternKit.slnx")))
return directory.FullName;

directory = directory.Parent;
}

throw new DirectoryNotFoundException("Could not find PatternKit repository root.");
}
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.65%. Comparing base (3b86a5f) to head (6d19507).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #334      +/-   ##
==========================================
+ Coverage   89.66%   95.65%   +5.98%     
==========================================
  Files         484      484              
  Lines       39951    39951              
  Branches     5744     5744              
==========================================
+ Hits        35823    38214    +2391     
+ Misses       1873     1737     -136     
+ Partials     2255        0    -2255     
Flag Coverage Δ
unittests 95.65% <ø> (+5.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

🔍 PR Validation Results

Version: ``

✅ Validation Steps

  • Build solution
  • Run tests
  • Build documentation
  • Dry-run NuGet packaging

📊 Artifacts

Dry-run artifacts have been uploaded and will be available for 7 days.


This comment was automatically generated by the PR validation workflow.

@JerrettDavis JerrettDavis force-pushed the benchmarkdotnet-complete-pattern-matrix branch from 8f70f23 to 59994e1 Compare May 23, 2026 02:36
Copilot AI review requested due to automatic review settings May 23, 2026 02:47
@JerrettDavis JerrettDavis force-pushed the benchmarkdotnet-complete-pattern-matrix branch from 59994e1 to 8f721e2 Compare May 23, 2026 02:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 14 changed files in this pull request and generated 6 comments.

Comment on lines +74 to +86
private static string FindRepoRoot()
{
var directory = new DirectoryInfo(AppContext.BaseDirectory);
while (directory is not null)
{
if (File.Exists(Path.Combine(directory.FullName, "PatternKit.slnx")))
return directory.FullName;

directory = directory.Parent;
}

throw new DirectoryNotFoundException("Could not find PatternKit repository root.");
}
Comment on lines 14 to 17
public static IConfig Create()
=> ManualConfig.Create(DefaultConfig.Instance)
.AddJob(Job.Default.WithId("net10.0"))
.AddJob(Job.Default.WithId("current-tfm"))
.AddDiagnoser(MemoryDiagnoser.Default)
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
Comment thread docs/guides/benchmarks.md
Comment on lines 19 to +21
Benchmark output should be reviewed as part of pattern hardening work. When a pattern has both fluent and generated APIs, the benchmark must include both routes with categories for the pattern family, pattern name, route, and phase.

The benchmark suite also includes coverage matrix benchmarks for every pattern in the production-readiness catalog and every source generator under `src/PatternKit.Generators`. Those matrix benchmarks are validated by TinyBDD tests so a new pattern or generator cannot be added without appearing in BenchmarkDotNet output.
Comment on lines 5 to 15
Run the full benchmark suite from the repository root:

```powershell
dotnet run -c Release --project benchmarks/PatternKit.Benchmarks -- --artifacts artifacts/benchmarks
```

Run one pattern family:

```powershell
dotnet run -c Release --project benchmarks/PatternKit.Benchmarks -- --filter *LeaderElection* --artifacts artifacts/benchmarks
```
Comment on lines +23 to +27
private static IReadOnlyList<PatternBenchmarkRoute> CreateRoutes()
{
var catalog = new PatternKitPatternCatalog();
var routes = new List<PatternBenchmarkRoute>(catalog.Patterns.Count * 4);

@JerrettDavis JerrettDavis force-pushed the benchmarkdotnet-complete-pattern-matrix branch from 8f721e2 to 6d19507 Compare May 23, 2026 03:00
@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/23/2026 - 03:05:24
  Coverage date: 05/23/2026 - 03:03:27 - 05/23/2026 - 03:05:13
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1448
  Files: 590
  Line coverage: 94.5%
  Covered lines: 39211
  Uncovered lines: 2239
  Coverable lines: 41450
  Total lines: 91054
  Branch coverage: 75.6% (11545 of 15271)
  Covered branches: 11545
  Total branches: 15271
  Method coverage: 96.1% (7796 of 8107)
  Full method coverage: 88.2% (7156 of 8107)
  Covered methods: 7796
  Fully covered methods: 7156
  Total methods: 8107

PatternKit.Core                                                                                                     95.5%
  PatternKit.Application.AntiCorruption.AntiCorruptionLayer<T1, T2>                                                 90.4%
  PatternKit.Application.AntiCorruption.AntiCorruptionResult<T>                                                      100%
  PatternKit.Application.AuditLog.AuditLogAppendResult<T>                                                           85.7%
  PatternKit.Application.AuditLog.InMemoryAuditLog<T1, T2>                                                          95.4%
  PatternKit.Application.DataMapping.DataMapper<T1, T2>                                                             94.6%
  PatternKit.Application.DataMapping.DataMapperError                                                                  90%
  PatternKit.Application.DataMapping.DataMapperResult<T>                                                            84.6%
  PatternKit.Application.DomainEvents.DomainEventDispatcher<T>                                                      95.4%
  PatternKit.Application.DomainEvents.DomainEventDispatchResult                                                      100%
  PatternKit.Application.EventSourcing.EventStoreAppendResult                                                        100%
  PatternKit.Application.EventSourcing.InMemoryEventStore<T1, T2>                                                   97.9%
  PatternKit.Application.EventSourcing.StoredEvent<T1, T2>                                                            80%
  PatternKit.Application.FeatureToggles.FeatureToggleDecision                                                       87.5%
  PatternKit.Application.FeatureToggles.FeatureToggleRule<T>                                                         100%
  PatternKit.Application.FeatureToggles.FeatureToggleSet<T>                                                         96.9%
  PatternKit.Application.IdentityMap.IdentityMap<T1, T2>                                                             100%
  PatternKit.Application.IdentityMap.IdentityMapResult<T>                                                           92.8%
  PatternKit.Application.MaterializedViews.MaterializedView<T1, T2>                                                 98.4%
  PatternKit.Application.Repository.InMemoryRepository<T1, T2>                                                      92.8%
  PatternKit.Application.Repository.RepositoryResult<T>                                                             93.3%
  PatternKit.Application.ServiceLayer.ServiceLayerOperation<T1, T2>                                                 96.7%
  PatternKit.Application.ServiceLayer.ServiceLayerResult<T>                                                         94.7%
  PatternKit.Application.ServiceLayer.ServiceLayerRule<T>                                                            100%
  PatternKit.Application.Specification.Specification<T>                                                              100%
  PatternKit.Application.Specification.SpecificationRegistry<T>                                                     93.3%
  PatternKit.Application.TableDataGateway.InMemoryTableDataGateway<T1, T2>                                            86%
  PatternKit.Application.TableDataGateway.TableGatewayResult<T>                                                     82.3%
  PatternKit.Application.TransactionScript.TransactionScript<T1, T2>                                                  97%
  PatternKit.Application.TransactionScript.TransactionScriptError                                                     90%
  PatternKit.Application.TransactionScript.TransactionScriptResult<T>                                                100%
  PatternKit.Application.UnitOfWork.UnitOfWork                                                                      90.9%
  PatternKit.Application.UnitOfWork.UnitOfWorkResult                                                                94.7%
  PatternKit.Application.UnitOfWork.UnitOfWorkRollbackResult                                                         100%
  PatternKit.Application.UnitOfWork.UnitOfWorkStep                                                                   100%
  PatternKit.Behavioral.Chain.ActionChain<T>                                                                         100%
  PatternKit.Behavioral.Chain.AsyncActionChain<T>                                                                    100%
  PatternKit.Behavioral.Chain.AsyncResultChain<T1, T2>                                                              97.7%
  PatternKit.Behavioral.Chain.ResultChain<T1, T2>                                                                    100%

@JerrettDavis JerrettDavis merged commit 0157494 into main May 23, 2026
12 checks passed
@JerrettDavis JerrettDavis deleted the benchmarkdotnet-complete-pattern-matrix branch May 23, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants