-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up / rewrite resolve #1935
Comments
labelled as postponed since it depends on another bug, and assigning to you, @marijnh , since you seem like the most qualified person to do it. |
I should mention that rustdoc uses resolve to locate reexports and needs it to be tolerant of errors. |
We agreed that I will finish this, in Marijn's absence. |
Reassigned to @pcwalton to reflect reality... |
This is done; if any subsidiary issues show up, file separate bugs. |
Optimizing Stacked Borrows (part 1?): Cache locations of Tags in a Borrow Stack Before this PR, a profile of Miri under almost any workload points quite squarely at these regions of code as being incredibly hot (each being ~40% of cycles): https://github.com/rust-lang/miri/blob/dadcbebfbd017aac2358cf652a4bd71a91694edc/src/stacked_borrows.rs#L259-L269 https://github.com/rust-lang/miri/blob/dadcbebfbd017aac2358cf652a4bd71a91694edc/src/stacked_borrows.rs#L362-L369 This code is one of at least three reasons that stacked borrows analysis is super-linear: These are both linear in the number of borrows in the stack and they are positioned along the most commonly-taken paths. I'm addressing the first loop (which is in `Stack::find_granting`) by adding a very very simple sort of LRU cache implemented on a `VecDeque`, which maps recently-looked-up tags to their position in the stack. For `Untagged` access we fall back to the same sort of linear search. But as far as I can tell there are never enough `Untagged` items to be significant. I'm addressing the second loop by keeping track of the region of stack where there could be items granting `Permission::Unique`. This optimization is incredibly effective because `Read` access tends to dominate and many trips through this code path now skip the loop entirely. These optimizations result in pretty enormous improvements: Without raw pointer tagging, `mse` 34.5s -> 2.4s, `serde1` 5.6s -> 3.6s With raw pointer tagging, `mse` 35.3s -> 2.4s, `serde1` 5.7s -> 3.6s And there is hardly any impact on memory usage: Memory usage on `mse` 844 MB -> 848 MB, `serde1` 184 MB -> 184 MB (jitter on these is a few MB).
Resolve has organically grown into a very complicated, rather slow, probably partially redundant tangle. When a decision is made on #1893 , some work should be done on cleaning it up.
The text was updated successfully, but these errors were encountered: