Skip to content

Improve memory arena allocation under contention#10090

Merged
michaelstaib merged 2 commits into
mainfrom
mst/mea-volatile
Jul 11, 2026
Merged

Improve memory arena allocation under contention#10090
michaelstaib merged 2 commits into
mainfrom
mst/mea-volatile

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 11, 2026 17:19

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.

Pull request overview

This PR reduces synchronization overhead in the MemoryArena allocation hot path by replacing Interlocked.Read with Volatile.Read for reading the packed _state cursor, aiming to improve throughput under contention while preserving atomicity and required memory ordering.

Changes:

  • Switched _state reads in Rent from Interlocked.Read to Volatile.Read.
  • Switched the _state page-index check in RollOver from Interlocked.Read to Volatile.Read.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (2/2)

File Covered Changed Patch %
…/HotChocolate/Utilities/src/Utilities.Buffers/MemoryArena.cs 2 2 100.0% 🟢

Project coverage: 53.4% (227648/426405 lines)

@michaelstaib michaelstaib merged commit 6694601 into main Jul 11, 2026
7 of 8 checks passed
@michaelstaib michaelstaib deleted the mst/mea-volatile branch July 11, 2026 18:15
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