Skip to content

ASP.NET Core perf effort: summary of open performance PRs #70219

Open

Agent suggestions

Public preview

Description

@davidfowl

ASP.NET Core perf effort: summary of open performance PRs

Status: nothing is merged yet. Everything below is an open PR awaiting maintainer review. The numbers are expected improvements from those PRs, not shipped gains.

Approach

  • AI agent sessions ("workers") are each assigned one area of ASP.NET Core. They check existing PRs first to avoid duplicating work.
  • Workers read the hot paths to find avoidable allocation and CPU work. They measure each candidate with BenchmarkDotNet A/B runs (main vs. PR, 3 interleaved rounds with MemoryDiagnoser).
  • A candidate becomes a PR only if its benchmark shows a measurable win. Candidates whose gains are too small to matter are dropped.
  • Each win gets one focused PR, with no public API or behavior changes and no unsafe code (see Rules below).
  • A periodic automated, read-only check ("triage") runs about every 20 minutes and covers CI, review threads and conflicts for every open perf PR. A worker is started to fix or answer each PR it flags. Real CI failures are fixed. Flaky failures are retriggered with an empty commit plus a comment explaining the evidence.
  • Nothing is merged without maintainer review and approval.
  • All agents (coordinator and workers) ran on Claude Opus 5.5 (claude-opus-5.5) via GitHub Copilot.

Human involvement: it wasn't magic or hands-off

My involvement wasn't just supplying a prompt. I was setting constraints, asking for measurements, and providing engineering judgment throughout the run. Here are some actual messages, with spelling preserved.

Defining the work and requiring evidence

Look for more opportunities to improve the performance of the whole stack. Go component by component and do it, measure, test, experiment and then make a PR if it's good. Use minimum of 5 concurrent sessions to do this work

Keeping compatibility in scope

Consider breaking changes. We don’t want to change public APIs to breaking changes. We can consider new APIs but that’s a hassle as well. Stick to internal implementation that we can optimize.

Flagging the risks behind an optimization

Changing object lifetimes, pooling are possible but consider data exposed to callers or customers

Reinforcing correctness

Consider also that we need to make sure PRs are green, it has to work not just be fast

Applying engineering judgment

We're trying to avoid as much unsafe code as possible. Better to build on really efficient BCL primitives instead of custom vectorization in most cases. Only extremely isoalted casses warrant it

Rules

Every change and every worker follows these rules:

  • No public API, breaking or behavior changes.
  • Pool or cache only when nothing pooled or cached is reachable by callers or leaks between requests.
  • No unsafe code. Prefer BCL primitives such as SearchValues, IndexOfAny and Ascii.
  • Each change ships with A/B benchmarks (3 interleaved rounds with MemoryDiagnoser) and passing tests.
  • Comments and PR descriptions posted by workers end with an AI-agent signature.

Executive summary

An AI-agent-driven effort to cut allocation and CPU overhead on ASP.NET Core hot paths, one component at a time.

Areas and changes

Area PRs What changed
Kestrel / HTTP/2 / HTTP/3 8 No string allocation for Content-Length, HPACK hashing, header append and validation fast paths, lazy HTTP/3 buffers
HTTP abstractions / headers / forms 14 Content-type fast paths, single-pass query and cookie decoding, multipart reads without MemoryStream, header formatting
Routing 6 DFA (deterministic finite automaton) matcher candidate sharing and pruning, policy edge building, link generation
Middleware 16 Response compression, output and response caching, CORS, static files and assets, logging, forwarded headers, rate limiting
Security / DataProtection / auth 14 Managed encryptor and AES-GCM in-place writes, TicketSerializer, authorization handler enumeration, bearer token authentication, ticket protection
MVC / Razor Pages 11 Model binding and validation, view rendering and lookup, content negotiation, tag helpers
Identity 7 PasswordValidator, UserValidator, UserManager construction, TOTP (time-based one-time password) and Base32, metrics and logger caching
Blazor / Components 7 RenderBatchWriter, keyed diff, SSR (server-side rendering) text writer, JS interop buffers
SignalR 8 Protocol parsing, hub activation, client target lookup, groups, streaming
OpenAPI 2 Resolving references, caching attribute lookups
Details: full PR list, status, incidents

Full PR list (93 open, 4 closed)

Kestrel / HTTP/2 / HTTP/3

HTTP abstractions / headers / forms

Routing

Middleware

Security / auth / DataProtection

MVC / Razor Pages

Identity

Blazor / Components

SignalR

OpenAPI

Closed as duplicates:

Status

Incidents and lessons

  • A CI retrigger once pushed a commit with an empty tree. It was rolled back, and retriggers now verify the diff before and after pushing.
  • A full-repo restore filled the disk. Workers now build only the projects they need.
  • Long blocking waits stalled workers. Builds and benchmarks now run in the background with capped retries.
  • Recurring flaky tests: CanResolveServices, Blazor Virtualization, NavigationLock and VariableHeight_HtmlTable E2E, and Kestrel Http2 StreamPool.
  • The first Reduce allocations in managed DataProtection protect/unprotect #70146 benchmark measured CNG instead of the managed path on Windows. It now pins the managed encryptor configuration.

In progress: Identity stack

Four parallel workers are covering the areas below. The 10 Identity and auth PRs (#70218 and #70220–#70228) came from this work.

  1. SignInManager, UserManager, the claims principal factory and SecurityStampValidator.
  2. Extensions.Core: password hasher, TOTP, token providers and passkeys.
  3. Cookie auth, ticket serialization, authorization and the EF Core stores.
  4. MapIdentityApi, bearer tokens and Identity UI.

🤖 Posted by ASP.NET Core Perf 2 (AI Agent)

Activity

  1. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Triage Summary

    Area: area-perf (cross-cutting summary of performance PRs spanning many areas)
    Type: Task (tracking/summary issue; no broken behavior or new feature requested)

    Potential Duplicates

    • None found

    Generated by Issue Triage Agent for dotnet/aspnetcore for #70219 · copilot · auto · 21.9 AIC · ⌖ 1.08 AIC · ⊞ 7.6K · ◷

  2. self-assigned this
    on Nov 1, 2026
  3. davidfowl commented on Nov 2, 2026

    @davidfowl
    MemberAuthor

    Perf effort status: the good, the bad and the ugly (2026-11-19, 23:40 UTC)

    TL;DR

    • The 99 perf/* PRs in this effort now stand at 40 merged, 34 open, 25 closed unmerged (since the 2026-11-19 08:51 UTC report: 0 / 0 / 0). This counts davidfowl's perf/* PRs, not unrelated contributors' branches (including Write W3C log entries directly to StreamWriter #69108); #70357 and #70435 remain open API proposal issues, not PRs.
    • Of the 34 open PRs, latest-head check rollups show 27 with no failed or pending checks, 7 with failures; #70200 has a pending macOS check as well as failures. All 34 still carry pending-ci-rerun and REVIEW_REQUIRED. A successful rollup does not clear a stale-validation label or grant approval.
    • Since the 08:51 UTC report, no cohort PR changed state or received a new head commit, formal review or comment. The previously noted four /review requests were commands, not formal reviews.
    pie title perf/* PRs (99)
        "Merged" : 40
        "Open, latest-head CI without failures or pending" : 27
        "Open, latest-head CI failure" : 7
        "Closed unmerged" : 25
    
    Loading

    The Good

    • The existing 40 merges include #70138, merged after DeagleGross's approval, and #70118, #70130, #70137, #70188 and #70224, merged without a formal APPROVED review. These remain historical outcomes, not new merges.
    • The #70164 review follow-up measured 1-byte multipart fields at 1,531 to 1,220 ns and 10,296 to 6,840 B in a representative interleaved BDN round. The PR subsequently closed unmerged. These isolated microbenchmarks do not establish end-to-end throughput, and #70146 and #70227 still lack an A/B measurement on their final reviewed heads.

    The Bad

    The Ugly

    • All 34 open PRs carry pending-ci-rerun, even the 27 with no failed or pending check on their latest head. All 34 show REVIEW_REQUIRED; #70200 also has a pending macOS check. CI guidance prohibits empty rerun commits and calls for explaining failures before targeted retries.
    • The measured Avoid StreamReader allocations in MultipartSection.ReadAsStringAsync #70164 tiny-field win also included a roughly 4.5% slowdown and slightly higher allocations on its 100 KB one-field benchmark; review feedback requested a simpler buffer-and-decode design before its closure. A win on one payload size was not a universal improvement.

    Lessons

    Updated 2026-11-19 23:40 UTC

    🤖 Posted by ASP.NET Core Perf 2 (AI Agent)

  4. Leonardo-Ferreira commented on Nov 2, 2026

    @Leonardo-Ferreira

    Those look really nice, 2 cents: Asp.Net, having a huge range of workloads, can be quite tricky to optimize... you may end-up speeding things up for one workload type but making things worst for another type. Microbenchmarking tends to "praise" results tied to performance, whereas MANY of us here are actually looking for a way to pack more containers in the same K8S node, and for that purpose, releasing the memory back to the OS faster would be MONUMENTAL! It would look very "bad" on your code-golf, it-runs-1million-req-per-sec benchmarks, but it could save billions of dollars worldwide on cloud costs...

  5. davidfowl commented on Nov 3, 2026

    @davidfowl
    MemberAuthor

    We’ve been doing this before AI was popular and this “peanut butter” is always worth it if the code complexity is not extreme. The microbenchmarks are great to understand the impact of the code itself but aren’t the entire story (we have bigger e2e benchmarks). I’m my experience these sorts of changes have always helped in the overall e2e (look at Toub’s performance posts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions