Skip to content

Auto-port 5.0: ByteBufAllocatorAllocPatternBenchmark: Ensure each index appears exactly once in releaseIndexes#16678

Merged
chrisvest merged 1 commit into
5.0from
auto-port-pr-16604-to-5.0
Apr 22, 2026
Merged

Auto-port 5.0: ByteBufAllocatorAllocPatternBenchmark: Ensure each index appears exactly once in releaseIndexes#16678
chrisvest merged 1 commit into
5.0from
auto-port-pr-16604-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16604 to 5.0
Cherry-picked commit: 61d3c4a


Motivation:

In ByteBufAllocatorAllocPatternBenchmark, the original random sampling allowed the same index to be selected multiple times, making live buffer count unpredictable and causing MAX_LIVE_BUFFERS to lose its intended meaning.

Modification:

Use Fisher-Yates shuffle for releaseIndexes.

Result:

Live buffer count is stable at MAX_LIVE_BUFFERS, each index appears exactly once in releaseIndexes.

…tly once in releaseIndexes (#16604)

Motivation:

In `ByteBufAllocatorAllocPatternBenchmark`, the original random sampling
allowed the same index to be selected multiple times, making live buffer
count unpredictable and causing `MAX_LIVE_BUFFERS` to lose its intended
meaning.

Modification:

Use
[Fisher-Yates](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
shuffle for releaseIndexes.

Result:

Live buffer count is stable at `MAX_LIVE_BUFFERS`, each index appears
exactly once in releaseIndexes.

(cherry picked from commit 61d3c4a)
@chrisvest chrisvest enabled auto-merge (squash) April 21, 2026 18:29
@chrisvest chrisvest added this to the 5.0.0.Final milestone Apr 21, 2026
@chrisvest chrisvest merged commit da92e4b into 5.0 Apr 22, 2026
30 of 33 checks passed
@chrisvest chrisvest deleted the auto-port-pr-16604-to-5.0 branch April 22, 2026 18:02
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.

3 participants