[#2577] ChannelOutboundBuffer.addFlush() unnecessary loop through all entries on multiple calls
Motivation: If ChannelOutboundBuffer.addFlush() is called multiple times and flushed != unflushed it will still loop through all entries that are not flushed yet even if it is not needed anymore as these were marked uncancellable before. Modifications: Check if new messages were added since addFlush() was called and only if this was the case loop through all entries and try to mark the uncancellable. Result: Less overhead when ChannelOuboundBuffer.addFlush() is called multiple times without new messages been added.
This commit is contained in:
parent
b8a7881588
commit
b627824b18
@ -173,6 +173,11 @@ public final class ChannelOutboundBuffer {
|
||||
}
|
||||
|
||||
void addFlush() {
|
||||
// There is no need to process all entries if there was already a flush before and no new messages
|
||||
// where added in the meantime.
|
||||
//
|
||||
// See https://github.com/netty/netty/issues/2577
|
||||
if (unflushed != tail) {
|
||||
unflushed = tail;
|
||||
|
||||
final int mask = buffer.length - 1;
|
||||
@ -187,6 +192,7 @@ public final class ChannelOutboundBuffer {
|
||||
i = i + 1 & mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the pending bytes which will be written at some point.
|
||||
|
Loading…
x
Reference in New Issue
Block a user