Skip to content

Always prefer direct buffers for pooled allocators if not explicit di…#15245

Merged
normanmaurer merged 1 commit into4.1from
direct_41
May 23, 2025
Merged

Always prefer direct buffers for pooled allocators if not explicit di…#15245
normanmaurer merged 1 commit into4.1from
direct_41

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

…… (#15232)

…sabled

Motivation:

We should always prefer direct buffers if the ByteBufAllocator implementations are pooled as deallocating these buffers should be rare.

Modifications:

  • Add new method to PlatformDependent that can be used to check if default direct buffer usage was explicit disabled
  • Use this method in our pooled ByteBufAllocator implementations to check if we should use direct buffers or not by default

Result:

Less memory copies and better performance when using the pooled allocators even if Unsafe can not be used.

#15232)

…sabled

Motivation:

We should always prefer direct buffers if the ByteBufAllocator
implementations are pooled as deallocating these buffers should be rare.

Modifications:

- Add new method to PlatformDependent that can be used to check if
default direct buffer usage was explicit disabled
- Use this method in our pooled ByteBufAllocator implementations to
check if we should use direct buffers or not by default

Result:

Less memory copies and better performance when using the pooled
allocators even if Unsafe can not be used.
@normanmaurer normanmaurer requested a review from chrisvest May 22, 2025 16:37
@normanmaurer normanmaurer added this to the 4.1.122.Final milestone May 22, 2025
@normanmaurer normanmaurer merged commit 6ea4c6c into 4.1 May 23, 2025
14 of 16 checks passed
@normanmaurer normanmaurer deleted the direct_41 branch May 23, 2025 04:59
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