Store locals in borrowck in BitSets - #161930
Conversation
3e50dfa to
805a6ea
Compare
|
This will probably be neutral or regression, but I want to see whether there's something interesting happening and whether this is a useful starting point to bitsetivize the main part of the algorithm @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Store locals in borrowck in BitSets
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f483b29): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.9%, secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.0%, secondary -5.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 474.678s -> 476.443s (0.37%) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Store locals in borrowck in BitSets
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (adb15a3): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary -0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 474.378s -> 474.623s (0.05%) |
|
This result looks better than the previous one. I wonder what happened with |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Store locals in borrowck in BitSets
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (7b6a9f4): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -4.0%, secondary -0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 475.447s -> 473.197s (-0.47%) |
This does conflict, but in only in practice, not principle. I don't expect that landing one will have a meaningful effect on the other (aside from just needing to do a simple rebase). I'm separately trying to refactor the live loan computation to be loans-per-point, rather than points-per-loan - which I think will conflict more. (Though, if you're in the area and want to work on that, then that's okay.) This is the primary benchmark that I'm trying to optimize for with that: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=63735c6a61638d343688d98380f717b7. But also, |
|
Thanks, makes sense, I'll keep experimenting here then.
Oh, then you might probably want to look at #161850. That's just a data structure swap, though, doesn't really change the computation.
I still have only surface level understanding of the algorithm, so I don't want to lick that cookie atm :D. |
|
What's the thinking behind this? I think there aren't that many locals in our benchmarks IIRC(?), though you may want to check the following crates instead (no idea about the relevant/boring distinction for these, for this PR I only have the max locals seen in some of their functions):
In liveness we separate the two and iterate through all these anyways, i.e. never needing to check if a given local is present in either set, and only do that boring vs relevant check in diagnostics for actual borrowck errors: we won't see such cases in benchmarks or crates.io. |
Mostly just an experiment. I want to see whether I can slowly morph some of the code that uses these to use set operations on those bitsets instead of iterating on each local separately. We can also avoid some memcopies and save memory, but that's not very impactful atm (sadly MaxRSS peak is probably not here, so it's difficult to tell if this helps memory usage even a little bit in some way).
wow, how is that even possible? That crate contains almost nothing. |
|
Most likely some error in accounting due to it relying on macros sorry, something like its users' functions only showing up as spans from that crate instead of their own; I'll have to see which dependent crates are actually causing these statics with big locals. |
|
☔ The latest upstream changes (presumably #162148) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments