-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Simplify HashMap layout calculation by using Layout #51163
Conversation
LGTM! |
@bors r+ |
📌 Commit 0fde52b has been approved by |
☔ The latest upstream changes (presumably #50880) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased. |
@bors r+ |
📌 Commit 01ba7cb has been approved by |
🔒 Merge conflict |
Rebased again. @SimonSapin I think this may conflict with your stabilization PR since I added |
@Amanieu I don’t mind the conflict, I’ll deal with it in the other PR. But that impl might be notable with respect to stability. If |
@bors r+ |
📌 Commit c6bebf4 has been approved by |
Simplify HashMap layout calculation by using Layout `RawTable` uses a single allocation to hold both the array of hashes and the array of key/value pairs. This PR changes `RawTable` to use `Layout` when calculating the amount of memory to allocate instead of performing the calculation manually. r? @SimonSapin
☀️ Test successful - status-appveyor, status-travis |
noticed that this PR have a lot of big red numbers in the perf run maybe there is something that can be improved? |
Hmm, that's worrying. I can think of three ways to improve performance:
|
Amanieu my NonZeroUsize PR marks them as inline but I did not see many
obvious perf improvements there. Maybe you could take a look there?
…On Sat 2. Jun 2018 at 13:07, Amanieu ***@***.***> wrote:
Hmm, that's worrying. I can think of two ways to improve performance:
- A lot of the Layout methods aren't implemented very efficiently,
they could be improved.
- A lot of the Layout methods aren't marked as #[inline], which hurts
us when the inputs are compile-time constants (size_of, align_of).
- We could cache the pointer to the (K, V) array in the RawTable
rather than recalculating it every time.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#51163 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA3Nplh0ZoNrzIIJB4klIEx9nYS2zGeBks5t4nHVgaJpZM4URTRe>
.
|
I think the main issue here is that I made some changes in a branch but I think that it would be easier if you just added those changes to your PR to avoid conflicts. |
I found this independently today and worked back to this PR. There was a subsequent improvement here: which points to these changes: But the improvement wasn't enough to get back all the perf that was lost. Can this PR be backed out? I'd say it has undone roughly 1/3 to 1/2 of the significant rustc perf improvement that had occurred in past few weeks, which is highly discouraging. |
Here is a Cachegrind diff comparing a rustc from May 27 against one from Jun 04. The numbers are instruction counts:
It's mostly additional hash table operations, perhaps involving |
Optimize layout calculations in HashMap This now produces the same assembly code as the previous implementation. cc #51163 @nnethercote @gnzlbg @andjo403
RawTable
uses a single allocation to hold both the array of hashes and the array of key/value pairs. This PR changesRawTable
to useLayout
when calculating the amount of memory to allocate instead of performing the calculation manually.r? @SimonSapin