perf: add BenchmarkDotNet pattern route benchmarks#332
Conversation
Dependency ReviewThe following issues were found:
License Issuesbenchmarks/PatternKit.Benchmarks/PatternKit.Benchmarks.csproj
OpenSSF Scorecard
Scanned Files
|
47a00e5 to
bbb87a3
Compare
Test Results 1 files 1 suites 2m 51s ⏱️ Results for commit 05449d8. ♻️ This comment has been updated with latest results. |
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.Benchmarksto 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; |
| => Fluent_CreateSupervisor() | ||
| .Schedule("replenish", _work, Now) | ||
| .RunDue(Now); |
| => Generated_CreateSupervisor() | ||
| .Schedule("replenish", _work, Now) | ||
| .RunDue(Now); |
| var election = GeneratedLeaderElectionBenchmark.CreateElection(); | ||
| var candidate = GeneratedLeaderElectionBenchmark.Create(_context); |
| 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 |
| 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 |
bbb87a3 to
05449d8
Compare
Code Coverage |
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.