Skip to content

perf(serialization): avoid delimiter array allocations - #10966

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-perf-reduce-hot-path-allocations-179
Sep 2, 2026
Merged

perf(serialization): avoid delimiter array allocations#10966
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-perf-reduce-hot-path-allocations-179

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 2, 2026

Copy link
Copy Markdown
Member

RuntimeTypeNameParser currently creates a new character array whenever its delimiter spans are accessed. Every named type segment uses the type-name delimiters, with additional arrays created for assembly-qualified names and compound alias literals.\n\nBack the delimiter spans with string literals and remove the unused tuple delimiter property. This preserves parsing behavior while eliminating short-lived array allocations from type-name parsing.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 2, 2026 08:35

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 review overview

🟢 Approval recommended

The change is a small, low-risk allocation optimization which preserves the same delimiter sets and has no remaining usage of the removed member.

Review tier: Lite
Findings: None

What changed in this PR

This PR optimizes RuntimeTypeNameParser in Orleans.Serialization by removing short-lived char[] allocations when accessing delimiter spans during runtime type-name parsing.

Changes:

  • Replaced delimiter-span properties which allocated new char[] { ... } with ReadOnlySpan<char> backed by string literals.
  • Removed the unused TupleDelimiters property.
File Description
src/​Orleans.Serialization/​TypeSystem/​RuntimeTypeNameParser.cs Eliminates delimiter array allocations by switching span sources to string literals and removes an unused delimiter property.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ReubenBond
ReubenBond merged commit b9d39bb into dotnet:main Sep 2, 2026
74 checks passed
@ReubenBond
ReubenBond deleted the rb-perf-reduce-hot-path-allocations-179 branch September 2, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants