Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PooledSlicedByteBuf and PooledDuplicatedByteBuf #3788

Closed
wants to merge 1 commit into from

Conversation

normanmaurer
Copy link
Member

Motivation:

At the moment when calling slice(...) or duplicate(...) on a Pooled*ByteBuf a new SlicedByteBuf or DuplicatedByteBuf. This can create a lot of GC.

Modifications:

Add PooledSlicedByteBuf and PooledDuplicatedByteBuf which will be used when a PooledByteBuf is used.

Result:

Less GC.

@normanmaurer normanmaurer added this to the 4.0.29.Final milestone May 15, 2015
@normanmaurer
Copy link
Member Author

@trustin @Scottmitch please review

@normanmaurer normanmaurer self-assigned this May 15, 2015
writerIndex(length);
maxCapacity(length);
setIndex(0, length);
markReaderIndex();
Copy link
Member

Choose a reason for hiding this comment

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

Should we wait for #3789 and update this to discardMarks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes :)

Am 15.05.2015 um 19:51 schrieb Scott Mitchell notifications@github.com:

In buffer/src/main/java/io/netty/buffer/SlicedByteBuf.java:

@@ -53,8 +61,10 @@ public SlicedByteBuf(ByteBuf buffer, int index, int length) {
adjustment = index;
}

this.length = length;


Reply to this email directly or view it on GitHub.

Motivation:

At the moment when calling slice(...) or duplicate(...) on a Pooled*ByteBuf a new SlicedByteBuf or DuplicatedByteBuf. This can create a lot of GC.

Modifications:

Add PooledSlicedByteBuf and PooledDuplicatedByteBuf which will be used when a PooledByteBuf is used.

Result:

Less GC.
@trustin
Copy link
Member

trustin commented May 20, 2015

LGTM

@normanmaurer
Copy link
Member Author

Cherry-picked into 4.0 (8a1a0b2), 4.1 (88b8558) and master (627831d)

@Scottmitch
Copy link
Member

@normanmaurer - good work! Can the branch be deleted?

@normanmaurer normanmaurer deleted the pooled_buf branch May 20, 2015 15:19
@normanmaurer
Copy link
Member Author

@Scottmitch done

@Scottmitch
Copy link
Member

This change will be reverted. See #4138

Scottmitch added a commit to Scottmitch/netty that referenced this pull request Aug 26, 2015
Motivation:
Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled.

Modifications:
- revert netty#3788

Result:
Less complexity, and less code to create new objects in majority of cases.
Scottmitch added a commit that referenced this pull request Aug 26, 2015
Motivation:
Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled.

Modifications:
- revert #3788

Result:
Less complexity, and less code to create new objects in majority of cases.
Scottmitch added a commit that referenced this pull request Aug 26, 2015
Motivation:
Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled.

Modifications:
- revert #3788

Result:
Less complexity, and less code to create new objects in majority of cases.
Scottmitch added a commit that referenced this pull request Aug 26, 2015
Motivation:
Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled.

Modifications:
- revert #3788

Result:
Less complexity, and less code to create new objects in majority of cases.
Scottmitch added a commit to Scottmitch/netty that referenced this pull request Aug 26, 2015
Motivation:
As part of the revert process in netty#4138 some index and mark updates were lost.

Modifications:
- Restore the index / mark updates made in netty#3788

Result:
Slice and Duplicate buffers index / marks are correctly initialized.
Scottmitch added a commit that referenced this pull request Aug 27, 2015
Motivation:
As part of the revert process in #4138 some index and mark updates were lost.

Modifications:
- Restore the index / mark updates made in #3788

Result:
Slice and Duplicate buffers index / marks are correctly initialized.
Scottmitch added a commit that referenced this pull request Aug 27, 2015
Motivation:
As part of the revert process in #4138 some index and mark updates were lost.

Modifications:
- Restore the index / mark updates made in #3788

Result:
Slice and Duplicate buffers index / marks are correctly initialized.
Scottmitch added a commit that referenced this pull request Aug 27, 2015
Motivation:
As part of the revert process in #4138 some index and mark updates were lost.

Modifications:
- Restore the index / mark updates made in #3788

Result:
Slice and Duplicate buffers index / marks are correctly initialized.
pulllock pushed a commit to pulllock/netty that referenced this pull request Oct 19, 2023
Motivation:
Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled.

Modifications:
- revert netty#3788

Result:
Less complexity, and less code to create new objects in majority of cases.
pulllock pushed a commit to pulllock/netty that referenced this pull request Oct 19, 2023
Motivation:
As part of the revert process in netty#4138 some index and mark updates were lost.

Modifications:
- Restore the index / mark updates made in netty#3788

Result:
Slice and Duplicate buffers index / marks are correctly initialized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants