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

Switch to using UnsafeContinuations in NIOAsyncWriter and NIOAsyncSequenceProducer #2541

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FranzBusch
Copy link
Contributor

Motivation

During the performance testing of the NIOAsyncChannel we saw most of the remaining allocations due to the usage of CheckedContinuation. We knew from the beginning that this might be something that we want to revisit down the line.

Modification

This PR changes from CheckedContinuations to UnsafeContination.

# Motivation
The current `NIOAsyncWriter` implementation expects that the delegate is called while holding the lock to avoid reentrancy issues. However, this prevents us from executing the delegate calls directly on the `EventLoop` if we are on it already.

# Modification
This moves all of the delegate calls outside of the locks.

# Result
Less allocations.
…ncSequenceProducer`

# Motivation
During the performance testing of the `NIOAsyncChannel` we saw most of the remaining allocations due to the usage of `CheckedContinuation`. We knew from the beginning that this might be something that we want to revisit down the line.

# Modification
This PR changes from `CheckedContinuation`s to `UnsafeContination`.
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.

None yet

1 participant