perf: Remove python coroutine/trampoline overhead in awaits for ~22% faster dependencies goal#23268
Merged
tobni merged 8 commits intopantsbuild:mainfrom Apr 28, 2026
Merged
Conversation
d44bec6 to
42a091a
Compare
Contributor
And correctly propagate outputs
2f770a0 to
4937324
Compare
It is not a coroutine
a1d0193 to
4dc0d52
Compare
dependencies goaldependencies goal
3284a8d to
4de3ef3
Compare
Previous method of "re-generatoring" was a hack
c8f8d11 to
bd98683
Compare
Makes _Concurrently and Call have the same shape
bd98683 to
735751e
Compare
benjyw
approved these changes
Apr 28, 2026
Contributor
benjyw
left a comment
There was a problem hiding this comment.
Tricky to review, but I had looked at this code a few months back for the call-by-name work, so I think this is sound. And if any part of it was not, we'd have seen that in CI.
Contributor
|
Excellent perf gain! |
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.
The numbers are measured targeting my company repo.
The improvements scales with the number of rule calls of a goal, as it it pure "per-call" python overhead that is eliminated.
Edit:
I purposefully have changed the typing to signal that the engine selectors aren't coroutines. I lived with the belief they were and that it was important. They were only coroutines because of wrappers, and nothing used the fact (anymore).