[ty] Cache constraint implication checks#25714
Merged
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 92.16%. The percentage of expected errors that received a diagnostic held steady at 87.31%. The number of fully passing files held steady at 92/134. |
Memory usage reportMemory usage unchanged ✅ |
|
Merging this PR will improve performance by 8.28%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | multithreaded |
1.8 s | 1.6 s | +10.21% |
| ⚡ | Simulation | ty_micro[typevar_mapping_accumulation] |
1,056.7 ms | 975.7 ms | +8.3% |
| ⚡ | WallTime | pydantic |
10.7 s | 9.9 s | +8.02% |
| ⚡ | Simulation | ty_micro[pydantic_core_schema_dict] |
119.8 ms | 112.4 ms | +6.61% |
Tip
Curious why this is faster? Use the CodSpeed MCP and ask your agent.
Comparing charlie/cache-direct-constraint-implications (ed1900d) with main (8cf0c77)
Footnotes
-
60 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
AlexWaygood
approved these changes
Jun 6, 2026
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
When building sequent maps, we repeatedly compare the same ordered pairs of range constraints to determine whether one directly implies the other. Each comparison performs assignability checks for the lower and upper bounds, even when an earlier sequent calculation has already checked the same pair.
This change caches the final boolean result for each ordered constraint pair in the constraint-set builder, including negative results. Sequent construction and solving behavior remain unchanged, while later checks can reuse the existing result.