-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Further optimize ch exec read #8775
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rantee this after effects or every once in a while
Contributor
Author
|
@ghostdogpr I'd appreciate your review on this |
Member
I'm completely unfamiliar with ZStream internals. Not sure who is, maybe @jdegoes ? |
Contributor
Author
|
@vigoo seems like you were on of the last to touch this area, can u please review? |
Contributor
Author
jdegoes
approved these changes
Apr 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
initial benchmark results:
after applying the optimizations:
optimization techniques applied:
ChannelExecutor.readUpstreama. make the internal read method tail recursive
b. instead of suspending on each recurse, count consecutive operations and suspend every N steps (currently set to 128), this is important in order to keep the stream interruptible.
c. reduce stack mutations by separating the current
Readfrom the rest, for some reads this means they'd never make it into the stack, for others it avoids pushing the same read immediately after popping it from the stack.ChannelExecutor.execToPullingChannel, implementreadUpstreamas a channel. this avoids going through effects for some code paths and eliminate the need for theonSuccessandonFailureeffects.ChannelExecutor.run, make sure frequent channel constructors appear earlier in the pattern matching.