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 an optimization tips document. #1024

Merged
merged 3 commits into from Jun 5, 2019

Conversation

Projects
None yet
2 participants
@glbrntt
Copy link
Contributor

commented Jun 3, 2019

Motivation:

NIO doesn't offer any tips of on how to write performant code. After
discussing with @weissi we decided it would be useful to gather and
document some useful tips and tricks.

Modifications:

Started an optimization tips document.

Result:

Easier for NIO users to write performant code.

Add an optimization tips document.
Motivation:

NIO doesn't offer any tips of on how to write performant code. After
discussing with @weissi we decided it would be useful to gather and
document some useful tips and tricks.

Modifications:

Started an optimization tips document.

Result:

Easier for NIO users to write performant code.

@Lukasa Lukasa requested a review from weissi Jun 3, 2019

@Lukasa Lukasa added this to the 2.3.0 milestone Jun 3, 2019

@Lukasa
Copy link
Contributor

left a comment

Great idea, and a great start! I've left some notes.

(i.e. is not one of `ByteBuffer`, `FileRegion`, `IOData` or
`AddressedEnvelope<ByteBuffer>`) needs to have careful attention paid to its
size. If the type isn't one of the aforementioned special cases then it must be
no greater than 24 bytes in size to avoid a heap-allocation.

This comment has been minimized.

Copy link
@Lukasa

Lukasa Jun 3, 2019

Contributor

We should elaborate here.

"It must be no greater than 24 bytes in size to avoid a heap-allocation each time it is added to a NIOAny."

This comment has been minimized.

Copy link
@Lukasa

Lukasa Jun 3, 2019

Contributor

You may also want to point to the use of MemoryLayout.size to work out the size for folks who are unsure.

This comment has been minimized.

Copy link
@glbrntt

glbrntt Jun 3, 2019

Author Contributor

Good idea :)

glbrntt and others added some commits Jun 3, 2019

@Lukasa

Lukasa approved these changes Jun 5, 2019

@Lukasa Lukasa merged commit 8aaaaab into apple:master Jun 5, 2019

2 checks passed

pull request validation (5.0) Build finished.
Details
pull request validation (5.1) Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.