Skip to content

perf: add BenchmarkDotNet pattern route benchmarks#332

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

perf: add BenchmarkDotNet pattern route benchmarks#332
JerrettDavis merged 1 commit into
mainfrom
benchmarkdotnet-pattern-routes

Conversation

@JerrettDavis
Copy link
Copy Markdown
Owner

Summary\n- add a dedicated PatternKit.Benchmarks BenchmarkDotNet project wired into the solution\n- add shared benchmark configuration with memory diagnostics plus markdown, CSV, and JSON summary exports\n- seed fluent-vs-source-generated benchmarks for Leader Election and Scheduler Agent Supervisor\n- document benchmark execution and contribution expectations\n\n## Tracking issues\n- #329 umbrella benchmark coverage matrix\n- #328 cloud architecture benchmark coverage\n- #331 enterprise integration and messaging benchmark coverage\n- #330 application, enterprise, and GoF benchmark coverage\n\n## Validation\n- dotnet restore benchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj\n- git diff --check\n\nLocal benchmark build still hits the known Windows Roslyn analyzer mismatch, so CI is the authoritative generator-backed build check.

@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

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

benchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj

PackageVersionLicenseIssue Type
BenchmarkDotNet>= 0NullUnknown License
Denied Licenses: GPL-2.0, GPL-3.0, AGPL-3.0

OpenSSF Scorecard

PackageVersionScoreDetails
nuget/BenchmarkDotNet >= 0 UnknownUnknown

Scanned Files

  • benchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj

@JerrettDavis JerrettDavis force-pushed the benchmarkdotnet-pattern-routes branch from 47a00e5 to bbb87a3 Compare May 23, 2026 01:35
@JerrettDavis JerrettDavis changed the title Add BenchmarkDotNet pattern route benchmarks perf: add BenchmarkDotNet pattern route benchmarks May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

Test Results

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

Results for commit 05449d8.

♻️ This comment has been updated with latest results.

@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.

@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.72%. Comparing base (a77441f) to head (05449d8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
+ Coverage   89.72%   95.72%   +5.99%     
==========================================
  Files         476      476              
  Lines       39346    39346              
  Branches     5634     5634              
==========================================
+ Hits        35303    37662    +2359     
+ Misses       1817     1684     -133     
+ Partials     2226        0    -2226     
Flag Coverage Δ
unittests 95.72% <ø> (+5.99%) ⬆️

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.

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 adds a dedicated BenchmarkDotNet project for PatternKit and seeds initial cloud-pattern benchmarks to compare fluent builder APIs with source-generated factories.

Changes:

  • Adds benchmarks/PatternKit.Benchmarks to the solution with shared BenchmarkDotNet config and JSON summary export.
  • Adds Leader Election and Scheduler Agent Supervisor benchmark classes.
  • Documents benchmark execution and contribution expectations.

Reviewed changes

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

Show a summary per file
File Description
PatternKit.slnx Adds the benchmarks project to the solution.
Directory.Packages.props Adds the central BenchmarkDotNet package version.
docs/guides/toc.yml Adds the benchmark guide to docs navigation.
docs/guides/benchmarks.md Documents running and structuring benchmarks.
benchmarks/PatternKit.Benchmarks/README.md Documents project-specific benchmark usage and expectations.
benchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj Defines the benchmark executable and references PatternKit projects/generators.
benchmarks/PatternKit.Benchmarks/packages.lock.json Locks benchmark project package dependencies.
benchmarks/PatternKit.Benchmarks/Program.cs Starts BenchmarkDotNet using the shared config.
benchmarks/PatternKit.Benchmarks/PatternKitBenchmarkConfig.cs Configures jobs, diagnostics, columns, exporters, and ordering.
benchmarks/PatternKit.Benchmarks/JsonSummaryExporter.cs Adds a custom JSON summary exporter.
benchmarks/PatternKit.Benchmarks/Cloud/LeaderElectionBenchmarks.cs Adds fluent and generated Leader Election benchmarks.
benchmarks/PatternKit.Benchmarks/Cloud/SchedulerAgentSupervisorBenchmarks.cs Adds fluent and generated Scheduler Agent Supervisor benchmarks.

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

.LeaseDuration(LeaseDuration)
.Clock(static () => Now)
.Build();
var candidate = Fluent_CreateElectionAndCandidate().Candidate;
Comment on lines +35 to +37
=> Fluent_CreateSupervisor()
.Schedule("replenish", _work, Now)
.RunDue(Now);
Comment on lines +42 to +44
=> Generated_CreateSupervisor()
.Schedule("replenish", _work, Now)
.RunDue(Now);
Comment on lines +58 to +59
var election = GeneratedLeaderElectionBenchmark.CreateElection();
var candidate = GeneratedLeaderElectionBenchmark.Create(_context);
Comment thread docs/guides/benchmarks.md
Run all benchmarks:

```powershell
dotnet run -c Release --project benchmarks/PatternKit.Benchmarks -- --artifacts artifacts/benchmarks
Run the full benchmark suite from the repository root:

```powershell
dotnet run -c Release --project benchmarks/PatternKit.Benchmarks -- --artifacts artifacts/benchmarks
Comment thread docs/guides/benchmarks.md
Run a single pattern:

```powershell
dotnet run -c Release --project benchmarks/PatternKit.Benchmarks -- --filter *SchedulerAgentSupervisor* --artifacts artifacts/benchmarks
Run one pattern family:

```powershell
dotnet run -c Release --project benchmarks/PatternKit.Benchmarks -- --filter *LeaderElection* --artifacts artifacts/benchmarks
@JerrettDavis JerrettDavis force-pushed the benchmarkdotnet-pattern-routes branch from bbb87a3 to 05449d8 Compare May 23, 2026 01:53
@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/23/2026 - 01:58:29
  Coverage date: 05/23/2026 - 01:56:42 - 05/23/2026 - 01:58:18
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1431
  Files: 582
  Line coverage: 94.6%
  Covered lines: 38663
  Uncovered lines: 2182
  Coverable lines: 40845
  Total lines: 89422
  Branch coverage: 75.3% (11316 of 15011)
  Covered branches: 11316
  Total branches: 15011
  Method coverage: 96.2% (7650 of 7946)
  Full method coverage: 88.3% (7021 of 7946)
  Covered methods: 7650
  Fully covered methods: 7021
  Total methods: 7946

PatternKit.Core                                                                                                     95.8%
  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 770a067 into main May 23, 2026
12 checks passed
@JerrettDavis JerrettDavis deleted the benchmarkdotnet-pattern-routes branch May 23, 2026 02:07
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