Skip to content
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

Merged
merged 1 commit into from
Jul 24, 2017

Conversation

michaelwoerister
Copy link
Member

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 #43300

r? @eddyb

@eddyb
Copy link
Member

eddyb commented Jul 20, 2017

r? @nikomatsakis Since I'm not sure what exact role it played.

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Jul 20, 2017
@alexcrichton alexcrichton added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 20, 2017
Copy link
Contributor

@nikomatsakis nikomatsakis left a 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()
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Member Author

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.

@michaelwoerister
Copy link
Member Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Jul 24, 2017

📌 Commit fa91eeb has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jul 24, 2017

⌛ Testing commit fa91eeb with merge c8b5f48621fa9e450b7d31836fe45c95e26c193f...

@bors
Copy link
Contributor

bors commented Jul 24, 2017

💔 Test failed - status-appveyor

@michaelwoerister
Copy link
Member Author

@bors rollup

@michaelwoerister
Copy link
Member Author

@bors retry

@alexcrichton
Copy link
Member

I've filed #43453 for that spurious failure.

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 24, 2017
…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
bors added a commit that referenced this pull request Jul 24, 2017
Rollup of 11 pull requests

- Successful merges: #43297, #43322, #43342, #43361, #43366, #43374, #43379, #43401, #43421, #43428, #43446
- Failed merges:
@bors bors merged commit fa91eeb into rust-lang:master Jul 24, 2017
@alexcrichton
Copy link
Member

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.

🌮 !!

@michaelwoerister
Copy link
Member Author

Nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants