[ty] Conservative narrowing places optimization#22734
[ty] Conservative narrowing places optimization#22734sharkdp merged 5 commits intoastral-sh:mainfrom
Conversation
e7da68d to
2136d82
Compare
2136d82 to
143779d
Compare
Typing conformance resultsNo changes detected ✅ |
|
|
Codspeed's reporting speedups of up to 4%, and this also looks like a pretty big win in terms of memory usage according to the primer report! |
Oh huh that's neat! The only cautionary note I have about this PR is that there's no particularly good mechanism in place for keeping the conservative places in line with the actually inferred places. Of course if we started narrowing a place that's not in the conservative place set then ty won't actually produce the narrowing, so that should be relatively catchable at test-time |
|
@ericmarkmartin is anything lacking to put this out of draft and up for review? |
No, not really, just still wasn't sure if we wanted this without the fix for #690 |
sharkdp
left a comment
There was a problem hiding this comment.
This is a really good optimization idea and a great implementation — thank you very much!
CodSpeed Performance ReportMerging this PR will improve performance by 4.18%Comparing Summary
Performance Changes
Footnotes
|
Summary
Add helpers to compute a conservative upper bound on the set of places a predicate might actually narrow, and use this to save work when computing narrowing constraints.
Test Plan
Existing tests pass