-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[jemalloc] set correct excess in realloc_excess #45514
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
2a984f6
to
52131c0
Compare
52131c0
to
3d1bf45
Compare
3d1bf45
to
d16c140
Compare
src/liballoc_jemalloc/lib.rs
Outdated
|
||
let flags = align_to_flags(new_align); | ||
let ptr = rallocx(ptr as *mut c_void, new_size, flags) as *mut u8; | ||
let alloc_size = sallocx(ptr as *mut c_void, flags); |
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.
sallocx
and *excess =
need to go into a !null branch.
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.
!!! indeed, should be fixed now
@kennytm can you try this? |
@Mark-Simulacrum would it be possible to run a perf of this? |
Is this function used anywhere right now? |
@arthurprs no idea FYI jemalloc devs say that |
@bors try |
[jemalloc] set correct excess in realloc_excess
Edit: there's also precedent in folly https://github.com/facebook/folly/blob/e8252dd7b5590427839eae4e4b2d76d2c4d9cff5/folly/memory/Malloc.h#L211
|
☀️ Test successful - status-travis |
This is what I expected, IIUC As soon as @Mark-Simulacrum does a perf run, I will commit the version with |
You can push and run try while you wait for perf; I just need the artifacts from try builds which stick around for 30 days. |
4f2d8de
to
45ef012
Compare
@kennytm could you try the last commit ? |
@bors try |
[jemalloc] set correct excess in realloc_excess
☀️ Test successful - status-travis |
@bluss a similar effect to the one in #45512 can be observed here. The micro-benchmarks of @arthurprs show that |
I'm a bit confused. What are we measuring? Is this function even used in the current codebase? |
@arthurprs it is not used anywhere in If they don't, this change should have no effect on the benchmarks but e.g. memory consumption in some cases varies up to 10-15%, that would be a lot of noise. The same applies to the other PR. |
I don't think it's used, can you double check? |
@arthurprs one of the regex benchmarks shows a 15% difference. I've followed all dependencies of the @Mark-Simulacrum thoughts? I think |
I think some of these tests are showing a high variance even in unrelated changes, example graph http://perf.rust-lang.org/index.html?start=2017-10-25&end=2017-10-29&stat=max-rss&absolute=false |
Moving to another libs team member... r? @sfackler |
I think this is good to go, ideally, I (or @arthurprs) will commit @arthurprs synthetic benchmarks to rustc (currently |
I may be missing some background here, but why are we optimizing a function that isn't called anywhere? |
Because we want to be able to call it from The fact that |
But were the perf comparisons above performed with that RawVec change? |
@sfackler No. The perf comparisons above are completely irrelevant because the compiler doesn't use @arthurprs did some synthetic benchmarks: #45514 (comment) where the cost of calling Once we enable this in |
Ok cool, that makes sense. Is there any reason not to land both this and the alloc_excess change or do you want to leave one open for now? |
They can be merged. The reason for the split was that I wanted to run perf on both separately because... 1) I thought perf benchmarked something more than the compiler (which it doesn't; external crates could have been using Had I knew all of this this would have been merged in @arthurprs together one week ago. |
Ok, let's merge both into this PR and land it to avoid having to wait on bors twice. |
@bors r+ |
📌 Commit 549ab77 has been approved by |
[jemalloc] set correct excess in realloc_excess
☀️ Test successful - status-appveyor, status-travis |
No description provided.