This repository was archived by the owner on Nov 30, 2026. It is now read-only.
Repository navigation
[AutoPerf F050] Avoid numeric quality exceptions in Accept parsing - #51
Draft
jaslawinMs wants to merge 1 commit into
Draft
jaslawinMs wants to merge 1 commit into
jaslawinMs wants to merge 1 commit into
Conversation
Share the existing media-type parser with an internal non-throwing quality path while preserving public error details. Cover actual comma recovery, exception counts, and public quality errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a24edcfd-1bb9-4160-afce-6ba54b1b7f00
This branch has not been deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Avoid numeric quality exceptions in Accept parsing
Avoid numeric quality exceptions in the internal Accept parser
Description
Fork-only AutoPerf F050 measured tradeoff proposal, not a universal net-performance win.
Share the existing media-type parser through an internal
double.TryParsequality path using the original number style/culture. Keep the public factory's throwing details by passing its invalid numeric segment back todouble.Parse. Preserve original Accept recovery/catch/locals, media-type segment identity/offset/quality and public signatures/defaults. Empty quality at end still keeps its separateArgumentOutOfRangeExceptionfallback.Final actual-request formatter selection: three permitted comparisons consumed, with only round3 supporting the final source and corrected checksum harness.39 fixed cases/eight observations per case,234 total outcomes and matching actual producer receipts.
Selector_Invalid_1Selector_Invalid_8Selector_Invalid_32Selector_Mixed_8Explicit tradeoffs: all seven public factory controls are slower. Valid controls are8.73-25.28% slower; public invalid quality is16.23% slower and adds168 B/op (456 to624), despite preserved observed error type/message. Some valid/unsupported parser/selector controls are also slower. Both rejected source shapes and the initial interface-foreach observer are retained; their results are not merged with the single final-source pair. Whether the public-control costs are acceptable needs review.
Immutable complete evidence at8d18a03: all39 final cases, all234 raw measurements/actual receipts, both benchmark projects, exact source/owner hashes, three75-file owner-only closures, all red/green/preparation outcomes, commands and limitations. The final baseline reuses the exact original owning DLL/PDB with byte-identical final harness/deps/runtime/other assemblies.
The inspected dotnet/aspnetcore#70166 optimizes other content-negotiation allocations, not this numeric-quality exception seam. No upstream issue/PR or API shape proposal is created.
Requirement coverage
AcceptHeaderParserTest.ParseAcceptHeader_InvalidQuality_RecoversWithoutThrowing: all six original rows fail for exactly one actual FormatException; all six final rows passAcceptHeaderParserTest.CreateMediaTypeSegmentWithQuality_InvalidQuality_PreservesPublicException: five rows pass on original/finalAcceptHeaderParserTest.CreateMediaTypeSegmentWithQuality_EmptyQualityAtEnd_PreservesPublicExceptionandAcceptHeaderParserTest.CreateMediaTypeSegmentWithQuality_EmptyQualityBeforeComma_PreservesPublicException: pass on original/finalExact validation commands/results (every session first
. .\activate.ps1from repository root):Passed164/164 targeted tests, all13 unique new reported rows. Both earlier prototypes pass163 each. Original is expected red157/six exact exception-count failures; exact original owner with final test binaries passes158 controls/seven public-contract rows and fails only those same six rows:
All five valid suites retain805 passing outcomes/12 expected original failures, no skips. Initial missing-assets/nullable/public-empty expectation/harness-reference preparation evidence is retained separately.
Builds passed zero warnings/errors; all five snapshots passed39 original-oracle producer/consumer checks, including measured public exception messages.
Both passed. All six measured launches passed39 cases/eight observations with this exact command:
Shared Windows host; pinned SDK/runtime, BDN0.13.0, Release/x64/in-process/concurrent server GC; serial builds/tests/measurements with
-m:2. No fourth comparison. Whole-MVC functional workflows, HTTP response serialization/network throughput, cold/JIT, contention/memory pressure, other runtimes/platforms and JIT/frame attribution were not verified. Final-source effect-size repeatability is limited to one paired comparison.Fixes #50