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

Short-circuit ByteBuf::release #13782

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

franz1981
Copy link
Contributor

Motivation:

ReferenceCountUtil::safeRelease can both hit interface virtual calls and requires checking for an interface type (ReferenceCounted)

Modifications:

Perform a class check to save both.

Result:

Faster buffers release

@franz1981
Copy link
Contributor Author

franz1981 commented Jan 16, 2024

This just remove the itable_stub presence on release, on the right, eg

image

Despite being a tiny amount, overall, in the global picture, for the write/flush path, is still an unecessary cost, see

image

where the itable_stub cost ~1.5% of the cost in such path, a tiny fraction, but as costy as performing useful work.

@hyperxpro
Copy link
Contributor

In these scenarios, I really love pattern-type matches.

Motivation:

ReferenceCountUtil::safeRelease can both hit interface virtual calls and requires checking for an interface type (ReferenceCounted)

Modifications:

Perform a class check to save both.

Result:

Faster buffers release
@normanmaurer normanmaurer merged commit e2859f4 into netty:4.1 Jan 19, 2024
15 checks passed
franz1981 added a commit to franz1981/netty that referenced this pull request Feb 9, 2024
Motivation:

ReferenceCountUtil::safeRelease can both hit interface virtual calls and
requires checking for an interface type (ReferenceCounted)

Modifications:

Perform a class check to save both.

Result:

Faster buffers release
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

4 participants