Skip to content

Fix redundant multipart path token allocations - #10601

Merged
tobias-tengler merged 3 commits into
mainfrom
tte/avoid-multipart-path-tokens
Oct 18, 2026
Merged

tobias-tengler merged 3 commits into
mainfrom
tte/avoid-multipart-path-tokens

Conversation

@tobias-tengler

@tobias-tengler tobias-tengler commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Parsing an incoming multipart variable path creates a Split token array and strings for skipped tokens and numeric tokens that are immediately parsed as indexes.

This PR scans the original path as spans and creates strings only for retained keys. The existing linked key/index segments, right-to-left parsing, validation order, current-culture numeric behavior and file bindings are preserved.

Method Version Mean Ratio Allocated Alloc Ratio
Incoming map, empty control main 7.913 ns 1.00 56 B 1.00
Incoming map, empty control PR 7.928 ns 1.00 56 B 1.00
Incoming map, two-file list main 225.143 ns 1.00 912 B 1.00
Incoming map, two-file list PR 187.629 ns 0.83 688 B 0.75
Incoming map, nested two-file list main 293.119 ns 1.00 1208 B 1.00
Incoming map, nested two-file list PR 258.234 ns 0.88 854.5 B 0.71
Incoming map, one file main 94.999 ns 1.00 401.5 B 1.00
Incoming map, one file PR 79.839 ns 0.84 332.5 B 0.83

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (27/27)

File Covered Changed Patch %
…/AspNetCore/src/AspNetCore.Pipeline/Parsers/VariablePath.cs 27 27 100.0% 🟢

Project coverage: 59.0% (311578/527844 lines)

@tobias-tengler tobias-tengler changed the title [HTTP] Fix redundant multipart path token allocations Fix redundant multipart path token allocations Oct 18, 2026
@tobias-tengler
tobias-tengler marked this pull request as ready for review October 18, 2026 08:44
Copilot AI balanced review requested due to automatic review settings October 18, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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