Repository navigation
perf(bench): BenchmarkDotNet suite for hot paths with a nightly regression check - #301
Merged
Merged
Conversation
…ssion check Adds tests/AgentOs.Benchmarks (BenchmarkDotNet 0.15.8, memory diagnoser on every benchmark, no network/DB), a baseline comparer (fails on >20% Mean regression or a new allocation on a 0 B benchmark) unit-tested in AgentOs.Tests, the perf.yml workflow (manual + nightly) and docs/architecture.md section 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Twi9motDLcziFta5zJSDs
Measured by tests/AgentOs.Benchmarks (ShortRun, before -> after): - SettingsService.GetAsync: lock path + platform row key precomputed per descriptor; 168-176 B -> 0 B per read (TenantOverride 282 -> 178 ns). - EfAppConfigStore cache: (tenant, key) tuple instead of a 'tenant:key' string (also removes a separator collision); 104 B -> 32 B per hit. - UntrustedText.Wrap: one builder, runs copied between special chars via SearchValues; 4 KB body 9.3 -> 2.6 us, 23.7 -> 16.0 KB. - SettingsSearch.Find: no per-page/per-descriptor concatenation; ~33 KB -> 0.6-1.2 KB per keystroke. - AgentRoles.Canonical: span alternate lookup for '<Role>Agent' names; 160 B -> 0 B for the Insights name set. - JsonExtractor: skip direct parse attempts that cannot succeed (fenced / prose replies no longer throw and catch a JsonException); ~6-8 %. Baseline re-recorded for the affected classes; new tests pin the edge cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Twi9motDLcziFta5zJSDs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Twi9motDLcziFta5zJSDs
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…, nested if) - DesktopFoldBenchmarks: 97 * i was an int multiplication cast to double. - Benchmark input fields made readonly; IDE0044 enforced in .editorconfig as the build-time twin of cs/missed-readonly-modifier. - JsonExtractorBenchmarks setup reuses one StringBuilder. - UntrustedText: combine the CR branch's nested if (same behaviour). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Twi9motDLcziFta5zJSDs
… timing is advisory Review follow-up on #301 (the CodeQL fixes landed in 0e90f06). - BaselineComparer: fail when allocated bytes grow by more than the threshold plus a 64 B floor (not only 0 B -> >0 B); a benchmark listed without statistics is now a Failed row (new or baselined) instead of being skipped; --require-all turns baseline benchmarks missing from the run into failures. - Program: run mode exits 1 when any report failed or a validator raised a critical error; compare validates --threshold (fraction in (0,1] or a percentage with %, "20" is rejected), --noise-floor-ns, --alloc-floor-bytes, --timing gate|advisory, and emits ::error/::warning annotations on Actions. - perf.yml: nightly compares with --timing advisory (Mean regressions are warnings; allocations gate), a '*' run passes --require-all, the compare step runs even after a crashed run, and schedule/dispatch use separate concurrency groups with no cancel-in-progress for the nightly. - docs/architecture.md section 8 and the plan row describe the new gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Twi9kDppPDrQdKcyLB2zd
Resolve tests/AgentOs.Tests/AgentOs.Tests.csproj: keep main's linked RunContinuation.cs and this PR's linked BaselineComparer/ComparerArguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
hoangsnowy
marked this pull request as ready for review
November 1, 2026 11:22
hoangsnowy
pushed a commit
that referenced
this pull request
Nov 1, 2026
Brings in the on-prem install (#298) and the benchmark suite (#301); keeps the E1.10 rows/links alongside E1.9 in README, CHANGELOG, enterprise-readiness and infra/README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Twi9k4gQRBLRkgH7PJTWm
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.
Change description
Plan 1.9
perf(bench), following owner directive 2 ("measure, then fix"). Later commits fix CodeQL alerts (0e90f06, which also enforcesIDE0044at build time) and harden the gate after review (6edae2d).Commit 1: suite and gate
tests/AgentOs.Benchmarksis a BenchmarkDotNet 0.15.8 console app (the latest stable as of 2026-11-01) added toAgentOs.slnx. It is not a test project, sodotnet testdoes not run it.[MemoryDiagnoser]and realistic inputs. No network or DB: the EF settings store runs on the in-memory provider. They cover:CostCalculator(exact ids, dated and Vertex snapshots, unknown model, long-context tier) andModelCapabilities.TemperatureFor;SettingsService(tenant → platform → seed → default) andEfAppConfigStorecache hits;UntrustedText,RepoInstructions,PullRequestText, andJsonExtractoron ~100 KB agent replies;InMemorySessionRunFeedandBufferedToolInvocationLog;ByRole/LatencyByRolewithAgentRoles.Canonical, ActivitiesSettingsSearch.Find, and Board › KnowledgeKnowledgeLayout.Compute..github/workflows/perf.ymlruns on workflow_dispatch and nightly. It uses the ShortRun job, uploads the artifacts, then runscompare. Actions are pinned by SHA: checkout v7.0.1, setup-dotnet v6.0.0, upload-artifact v7.0.2.Comparison/BaselineComparer.cs, pure BCL, unit-tested inAgentOs.Testsincluding a deliberate O(n²) regression case) fails a benchmark when it:--filter '*'passes--require-all;::warning(see the machine caveat below).tests/AgentOs.Benchmarks/baseline/*.json(BenchmarkDotNet brief reports).docs/architecture.md§8.Commit 2: fixes for waste the suite measured. Same machine, ShortRun, before → after:
SettingsService.GetAsync(every LLM call / policy check)EfAppConfigStorecache hitUntrustedText.Wrap, 4 KB ticket bodyUntrustedText.Wrap, 40 KB body (capped)SettingsSearch.Find(per keystroke)AgentRoles.Canonicalover the Insights name setJsonExtractor.ExtractJson, fenced 100 KB reply(tenant, key)tuple, which also removes a latent collision between"a:b"+"c"and"a"+"b:c"."Qa Agent").Machine caveat: the baseline was recorded on a 4-vCPU Intel Xeon 2.1 GHz cloud VM, not on a GitHub-hosted runner. ShortRun error bars on that VM were large, and timing-only regressions on shared runners need a re-run before they mean anything. Allocation checks don't depend on the machine. To re-record, use the
benchmark-resultsartifact from aperf.ymlrun onmain(see the docs).Not covered: the plan entry also lists the event sink and ledger KPI queries. There is no Metrics module on
mainyet (plan 1.2), so those benchmarks will come with it.Type of change
Related issues
Plan
docs/plans/agentic-sdlc-v2.mditem 1.9, now marked shipped.Checklist
dotnet buildpasses locally in Release mode (0 errors; the only warning is the existing ASPIRE010 from AppHost)dotnet testpasses: 2014 passed, 86 skipped, 0 failed locally after rebasing on main at 877a714; CI is green on the current head; the Benchmarks project is not run🤖 Generated with Claude Code
https://claude.ai/code/session_016Twi9motDLcziFta5zJSDs