-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
perf: spawn tokio runtime once #5263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg, finally.
I have been dreading this for so long because this touches the test runner API.
tysm for doing this!!
this pulls in openssl again for apparently no reason, no idea why, perhaps the rustls feature? idk
some failing tests, because of blocking calls I think |
|
the only cargo change I'm seeing is the rustls feature maybe try after reverting this, no idea why this would cause it though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tysm!
step by step we're improving the test runner
Motivation
We're spawning thousands of tokio runtimes which accounts for ~50-60% of the time spent in the main thread. These calls happen both in parallel (where there is almost no gain), and in the end clean up (which speeds it up significantly). This happens in
RuntimeOrHandle::new().block_on(...)
which spawns a new tokio runtime to run a single future, then drops itBefore (41% + 17%):
After (no recorded calls):
Solution
Make test functions async and create a runtime in the CLI dispatch