Merged
Conversation
Contributor
Author
|
Note that this also fixes a leak, at least theoretically. Before this PR, the |
notgull
approved these changes
Dec 3, 2024
Contributor
notgull
left a comment
There was a problem hiding this comment.
LGTM, will merge once rebased on master.
| concurrent-queue = "2.5.0" | ||
| fastrand = "2.0.0" | ||
| futures-lite = { version = "2.0.0", default-features = false } | ||
| pin-project-lite = "0.2" |
Contributor
There was a problem hiding this comment.
Noting to myself that this is not a new dependency, since futures-lite imports it already.
By creating the future manually instead of relying on `async { .. }`, we
workaround rustc's inefficient future layouting. On
[a simple benchmark](https://github.com/hez2010/async-runtimes-benchmarks-2024)
spawning 1M of tasks, this reduces memory use from about 512 bytes per
future to about 340 bytes per future.
More context: hez2010/async-runtimes-benchmarks-2024#1
4ef4564 to
09ed703
Compare
Contributor
Author
|
Rebased. |
Contributor
Author
|
Thank you! |
Merged
Collaborator
|
Published in 1.13.2. |
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
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.
By creating the future manually instead of relying on
async { .. }, we workaround rustc's inefficient future layouting. On a simple benchmark spawning 1M of tasks, this reduces memory use from about 512 bytes per future to about 340 bytes per future.More context: hez2010/async-runtimes-benchmarks-2024#1
This PR is rebased onto #136 because tests fail otherwise; please consider that PR first. On this PR, the relevant part for review is the second commit.