perf: optimize EventHub cache mapping - #10767
Merged
ReubenBond merged 1 commit intoAug 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Optimizes Event Hubs application-property mapping in the in-memory stream cache to reduce allocations.
Changes:
- Uses zero-length cache segments for empty properties.
- Replaces LINQ mapping with allocation-conscious loops.
- Adds empty and round-trip mapping tests.
Show a summary per file
| File | Description |
|---|---|
test/Extensions/Orleans.Streaming.EventHubs.Tests/EventHubDataAdapterTests.cs |
Tests property mapping behavior. |
src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventDataExtensions.cs |
Optimizes property serialization and deserialization. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
This was referenced Aug 28, 2026
Merged
Merged
This was referenced Sep 4, 2026
This was referenced Sep 8, 2026
Closed
This was referenced Sep 16, 2026
Open
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.
Problem
Issue #1742 identified unnecessary work when mapping Event Hubs
EventDataapplication properties into and out of the pooled stream cache. Orleans-produced messages normally contain only the internalStreamNamespaceproperty, which is excluded from the cached application-property collection, but the adapter still serialized and deserialized an empty list for every message.Solution
Represent an empty application-property collection as a zero-length cache segment and construct the mutable empty dictionary directly when reading it. For messages with application properties, populate the serialized list and reconstructed dictionary with allocation-conscious loops instead of LINQ.
The representation is internal to each silo's in-memory cache, so it introduces no durable wire-format compatibility requirement. Application properties, duplicate-key errors, and the mutable
IDictionarycontract are preserved.Performance
BenchmarkDotNet on .NET 10 for the default no-application-properties path measured serialization improving from 117.6 ns / 128 B to 7.1 ns / 0 B, and deserialization improving from 74.6 ns / 112 B to 13.7 ns / 80 B. Messages with application properties retain equivalent throughput while the serialization-side temporary allocation drops from 280 B to 232 B for four properties.
Related to #1742.
Microsoft Reviewers: Open in CodeFlow