Experiment: replace thread locals with custom waker vtable #105
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.
This is a post to share experiment, not actual pull request. But its result is too impressive I couldn't resist sharing them. On my not-so-strict linux env, it shows clear ~40% perf improvement.
I don't have proper benchmark env setup ATM, but you can test it on your own env too.
But there's few subtle issues to note before shipping this idea:
waker_getter
nightly feature. This feature seems pretty trivial and I expect it to be stable soon-ish, but even if it happens it will take a quite while for this feature to follow up the MSRV policy.Waker::will_wake()
based optimizations.stream!
/try_stream!
macros can unpack the inner waker before polling its inner async block. But this implementation would not be trivial.