[ty] Adapt many_enum_members benchmark#24203
Merged
Conversation
Merging this PR will improve performance by 7.81%
Performance Changes
Comparing |
AlexWaygood
approved these changes
Mar 26, 2026
sharkdp
added a commit
that referenced
this pull request
Mar 26, 2026
## Summary We previously avoided recording `IsNonTerminalCall` calls in global scope (non-function scopes, to be precise) because we were worried about the performance implications. However, it turns out that this does not cause any slowdowns in our real world ty benchmarks (but see #24203). There is also no dramatic change in the ecosystem timings. closes astral-sh/ty#2480 ## Ecosystem Two false positives removed. ## Test Plan Adapted previously existing test
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.
Summary
This changes the
many_enum_membersbenchmark from this structure:to this structure:
The idea here is to make this benchmark less susceptible to changes in our reachability constraints (that we record for
printcalls). The idea of theprintstatements was only to have "uses" of these enum members. It was never the idea to be an example of 512 function calls in sequence.I'm certainly not trying to hide the fact that this benchmark revealed a huge regression in #23245. But it did so for the wrong reasons. We would have already had that regression on
mainif thoseprintcalls would have been inside another function scope. And so it seems fair to change the benchmark before we proceed with #23245 (which shows no regressions elsewhere, and even leads to performance improvements in real world projects).Adding Alex here as a reviewer since we discussed this in person.