Skip to content

Make the inherent impl overlap check linear-time #69009

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed

Make the inherent impl overlap check linear-time #69009

wants to merge 1 commit into from

Conversation

jonas-schievink
Copy link
Contributor

Despite #68911, this code was still showing up in profiles, so I turned it from a O(n²) comparison between all inherent impls to an O(n) algorithm that builds an intermediate hash map to find items with the same names. It also makes the code a bit clearer.

The actual performance gains I've measured are pretty small (1-3%), and it's not impossible that the hash map has a negative perf impact in some situations, so I'll query perf for this.

@rust-highfive
Copy link
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 9, 2020
@jonas-schievink
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Collaborator

bors commented Feb 9, 2020

⌛ Trying commit 11c7e82 with merge 696990e8079f8a668b38304d45e9528acaa5aca4...

@bors
Copy link
Collaborator

bors commented Feb 10, 2020

☀️ Try build successful - checks-azure
Build commit: 696990e8079f8a668b38304d45e9528acaa5aca4 (696990e8079f8a668b38304d45e9528acaa5aca4)

@rust-timer
Copy link
Collaborator

Queued 696990e8079f8a668b38304d45e9528acaa5aca4 with parent 71c7e14, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 696990e8079f8a668b38304d45e9528acaa5aca4, comparison URL.

@jonas-schievink
Copy link
Contributor Author

Looks like this causes a slight regression in packed-simd, even. If anyone has an idea for improving this, please let me know. If not I guess I'll close this and focus on other optimizations.

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2020
@JohnCSimon
Copy link
Member

Ping from triage: @jonas-schievink - can you please post your status or close this PR?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants