-
Notifications
You must be signed in to change notification settings - Fork 690
Add inlinability to ByteBuffer getters. #1220
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
Conversation
Motivation: In complex ByteBuffer parsing code a surprising amount of cost comes from retain/release operations that are emitted by the compiler around calls to readerIndex/writerIndex, readableBytes/writableBytes, and ByteBufferSlice._lowerBound. These are all straightforward computed properties based on usableFromInline operations, and so they can be made inlinable. Modifications: Joannis' sample benchmark runtime is halved by eliminating retains/releases. Result: Better, faster parsing code.
@swift-nio-bot test perf please |
performance reportbuild id: 27 timestamp: Mon Nov 4 11:08:49 UTC 2019 results
comparison
significant differences found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @Lukasa!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
Motivation:
In complex ByteBuffer parsing code a surprising amount of cost comes
from retain/release operations that are emitted by the compiler around
calls to readerIndex/writerIndex, readableBytes/writableBytes, and
ByteBufferSlice._lowerBound. These are all straightforward computed
properties based on usableFromInline operations, and so they can be made
inlinable.
Modifications:
Joannis' sample benchmark runtime is halved by eliminating
retains/releases.
Result:
Better, faster parsing code.