Make the inherent impl overlap check linear-time#69009
Make the inherent impl overlap check linear-time#69009jonas-schievink wants to merge 1 commit intorust-lang:masterfrom jonas-schievink:inherently-linear
Conversation
|
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion |
|
⌛ Trying commit 11c7e82 with merge 696990e8079f8a668b38304d45e9528acaa5aca4... |
|
☀️ Try build successful - checks-azure |
|
Queued 696990e8079f8a668b38304d45e9528acaa5aca4 with parent 71c7e14, future comparison URL. |
|
Finished benchmarking try commit 696990e8079f8a668b38304d45e9528acaa5aca4, comparison URL. |
|
Looks like this causes a slight regression in |
|
Ping from triage: @jonas-schievink - can you please post your status or close this PR? |
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.