Skip to content

Eliminate unnessary copy of ByteBuf on ByteToMessageDecoder removal#9662

Merged
normanmaurer merged 1 commit into4.1from
do_not_copy_on_removal
Oct 16, 2019
Merged

Eliminate unnessary copy of ByteBuf on ByteToMessageDecoder removal#9662
normanmaurer merged 1 commit into4.1from
do_not_copy_on_removal

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

At the moment we do a ByteBuf.readBytes(...) on removal of the ByteToMessageDecoder if there are any bytes left and forward the returned ByteBuf to the next handler in the pipeline. This is not really needed as we can just forward the cumulation buffer directly and so eliminate the extra memory copy

Modifications:

Just forward the cumulation buffer directly on removal of the ByteToMessageDecoder

Result:

Less memory copies

Motivation:

At the moment we do a ByteBuf.readBytes(...) on removal of the ByteToMessageDecoder if there are any bytes left and forward the returned ByteBuf to the next handler in the pipeline. This is not really needed as we can just forward the cumulation buffer directly and so eliminate the extra memory copy

Modifications:

Just forward the cumulation buffer directly on removal of the ByteToMessageDecoder

Result:

Less memory copies
@normanmaurer normanmaurer requested a review from njhill October 14, 2019 17:05
Copy link
Copy Markdown
Member

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

I was wondering why that was there.

@normanmaurer
Copy link
Copy Markdown
Member Author

@carl-mastrangelo yeah no idea ...

@normanmaurer normanmaurer added this to the 4.1.43.Final milestone Oct 14, 2019
@normanmaurer normanmaurer merged commit 3d7dba3 into 4.1 Oct 16, 2019
@normanmaurer normanmaurer deleted the do_not_copy_on_removal branch October 16, 2019 13:48
normanmaurer added a commit that referenced this pull request Oct 16, 2019
…9662)

Motivation:

At the moment we do a ByteBuf.readBytes(...) on removal of the ByteToMessageDecoder if there are any bytes left and forward the returned ByteBuf to the next handler in the pipeline. This is not really needed as we can just forward the cumulation buffer directly and so eliminate the extra memory copy

Modifications:

Just forward the cumulation buffer directly on removal of the ByteToMessageDecoder

Result:

Less memory copies
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