-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove unused DefPathTable::retrace_path() #43361
Conversation
r? @nikomatsakis Since I'm not sure what exact role it played. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a nit, but r=me once it is resolved to your satisfaction @michaelwoerister
@@ -149,7 +105,7 @@ impl DefPathTable { | |||
} | |||
|
|||
pub fn size(&self) -> usize { | |||
self.key_to_index.len() | |||
self.index_to_key.iter().map(|v| v.len()).sum() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know who calls this? This new version seems significantly more expensive (O(n) vs O(1)), so if it's in any sort of tight-loop, it may be worth keeping a separate counter. I didn't find any obvious callers using ripgrep
, but I could easily have missed things...
...if we do keep the O(n) version, maybe rename it to count_keys
or something more suggestive that this requires computation? This looks like a "pure getter" to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index_to_key
here is an array with two elements as far as I can tell (https://github.com/rust-lang/rust/pull/43361/files#diff-b4047ba27734e3c7e860eb844810a301R38) so probably not an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mark-Simulacrum is right, this is a 2-element array. And it's called only once per upstream crate IIRC. I would not worry about it.
@bors r=nikomatsakis |
📌 Commit fa91eeb has been approved by |
⌛ Testing commit fa91eeb with merge c8b5f48621fa9e450b7d31836fe45c95e26c193f... |
💔 Test failed - status-appveyor |
@bors rollup |
@bors retry |
I've filed #43453 for that spurious failure. |
…h, r=nikomatsakis Remove unused DefPathTable::retrace_path() `DefPathTable::retrace_path()` is not used anymore for a while now and removing it also removes the need to build the costly `DefPathTable::key_to_index` map for every upstream crate. cc rust-lang#43300 r? @eddyb
Although a bit noisy, this seems the most likely candidate in the rollup it landed in to be the cause of a nearly 5% reduction in memory usage on many benchmarks. 🌮 !! |
Nice |
DefPathTable::retrace_path()
is not used anymore for a while now and removing it also removes the need to build the costlyDefPathTable::key_to_index
map for every upstream crate.cc #43300
r? @eddyb