Repository navigation
Optimize NettyBackedChannelBuffer for direct buffer transfer - #16027
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16027 +/- ##
============================================
- Coverage 60.76% 60.75% -0.02%
- Complexity 11759 11760 +1
============================================
Files 1952 1952
Lines 88996 89012 +16
Branches 13419 13421 +2
============================================
- Hits 54080 54078 -2
- Misses 29353 29373 +20
+ Partials 5563 5561 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes buffer transfer operations in NettyBackedChannelBuffer by eliminating intermediate byte array copies when both source and destination are NettyBackedChannelBuffer instances. The changes leverage Netty's native ByteBuf transfer capabilities for direct buffer-to-buffer transfers while maintaining backward compatibility through a fallback path for other ChannelBuffer implementations.
Changes:
- Optimize
getBytes,setBytes,readBytes, andwriteBytesmethods to use direct Netty ByteBuf transfers when possible - Add type checking to detect NettyBackedChannelBuffer instances and use optimized path
- Maintain fallback to intermediate byte array copy for other ChannelBuffer implementations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Optimize getBytes/setBytes/readBytes/writeBytes methods - Avoid intermediate byte array copy when source/destination is NettyBackedChannelBuffer - Directly use Netty's ByteBuf transfer capabilities - Add fallback to intermediate array copy for other ChannelBuffer implementations - Improve performance by 4-5x for Netty-to-Netty buffer transfers
…dubbo/remoting/transport/netty4/NettyBackedChannelBufferTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2da618a to
0a7a9ef
Compare
Below are test code:
Test output: