-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use tikv-jemallocator in rustc/rustdoc in addition to jemalloc-sys when enabled. #83152
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 1b45a29fdf54f0ffae814c700149fd8f18b36442 with merge 0bcde55ea93243c9ca7a70e1c0a4ae9e5a8d5034... |
This comment has been minimized.
This comment has been minimized.
1b45a29
to
1bf6efa
Compare
1bf6efa
to
0549375
Compare
ci failure was just a tidy mistake (I ALWAYS forget to run that locally...) |
I don't think so, historically we haven't worried much about compile time for errors (see also https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/perfbot/near/229630033). I'd expect rustdoc to show any changes though, it does a lot of allocations. |
@jyn514 rustdoc doesn't appear to depend on this crate? In that case it may be using the libc allocator in all cases? |
Oh huh, I think you're right. Do you mind doing that here? You don't have to add jemalloc to cargo.toml, just load it from the sysroot (see the comment at the top of librustdoc/lib.rs). |
(I also testing with "jemalloc = true" in config.toml locally as even tho im on osx, its ci that turns that on, as well as used the more-correct jemalloc feature in rustc_driver) |
Does bor's need to re-queue with the new commits for rust-timer to catch up? |
Yes, otherwise rust-timer will use the build artifacts from the old commit. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit dad03db36b50c9cc8e935a48d0d8bc5aec5f83c2 with merge 4f4b85262ea011b219ebd71d3da9ac82605df32e... |
It would probably be better to use this fork which is more up to date with Jemalloc: |
@LifeIsStrange I'll take a look! |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
☀️ Test successful - checks-actions |
@guswynn hi, jemalloc is working on an unofficial release channel which would update every 1-3 months. |
3023: perf: switch global alloc to tikv-jemallocator r=doitian,driftluo a=zhangsoledad <!-- Thank you for contributing to nervosnetwork/ckb! If you haven't already, please read [CONTRIBUTING](https://github.com/nervosnetwork/ckb/blob/develop/CONTRIBUTING.md) document. If you're unsure about anything, just ask; somebody should be along to answer within a day or two. PR Title Format: 1. module [, module2, module3]: what's changed 2. *: what's changed --> ### What problem does this PR solve? gnzlbg/jemallocator#168 jemalloc/jemalloc#1497 see also: rust-lang/rust#83152 ### What is changed and how it works? Proposal: switch global alloc to tikv-jemallocator which is more up-to-date ### Related changes ### Check List <!--REMOVE the items that are not applicable--> Side effects - Performance regression - Breaking backward compatibility ### Release note <!-- Choose from None, Title Only and Note. Bugfixes or new features need a release note. --> ```release-note Title Only: Include only the PR title in the release note. ``` Co-authored-by: zhangsoledad <[email protected]>
This was added in rust-lang#83152, which has several errors in its comments. This commit also fix up the comments, which are quite wrong and misleading.
I know I'm late to the party, but: the first and third sentences here are correct, but the second sentence is mostly incorrect. Although this PR added a
Sized deallocation doesn't come into the picture; the improvement was all because |
@nnethercote One of the earlier perf runs up above in this pr used jemallocator (non-tikv) and more closely captured the much smaller, but still measurable effect of sized deallocation. The larger wins were the upgrade, as you mentioned; the pr description is likely outdated. Hearing that those sized dealloc apis are not being used, which led to #92222 Is very concerning to me, and I would need to dig deeper into why the |
That perf run is here and you'll see that almost every significant change is a
#92222's comment points to #81782 (comment), which has an explanation. |
BTW, this was still a great PR! Switching to tikv-jemallocator (well, tikv-jemalloc-sys, because tikv-jemallocator is bypassed) was a huge win, and adding it to rustdoc was also good. It's just that what actually happened and what everyone thought happened didn't quite match 😀 |
…-rustdoc, r=alexcrichton Remove useless `#[global_allocator]` from rustc and rustdoc. This was added in rust-lang#83152, which has several errors in its comments. This commit also fix up the comments, which are quite wrong and misleading. r? `@alexcrichton`
@nnethercote oh WOW did not know about the complexity of how rustc is build is decoupling |
Not that I know of. And given that sized deallocation doesn't appear to be a win, there's not much motivation for it. |
Switch to maintained version of jemallocator like rustc did in: rust-lang/rust#83152
Switch to maintained version of jemallocator like rustc did in: rust-lang/rust#83152
* Update clap to 3.0 and improve argument parsing and help output. Update clap to 3.0 and improve argument parsing and help output: - Update clap from 3.0.0-beta4 to 3.0. - Update help output text. - Allow easy specifying of "-1" for -O option (allow_hyphen_values(true)). - Make -v var=value as last argument before program work without need for "--" or other argument after. - Make -i and -F mutually exclusive as specified field separator as -F is not used when parsing input files as CSV or TSV. * Update itoa from 0.4 to 1.0. Update itoa from 0.4 to 1.0. itoa::Buffer::new() allocates the necessary space on the stack automatically, and usage is similar to ryu now. * Update other dependencies. Update other dependencies. * Switch to maintained version of jemallocator. Switch to maintained version of jemallocator like rustc did in: rust-lang/rust#83152
In #81782 it was mentioned that one reason rustc may benefit from minimalloc is it doesn't use the
sdallocx
api from jemalloc.Currently, on unix, rust uses jemalloc by importing its symbols to use them with the default, System (libc) global allocator.
This PR switches its global alloc to
tikv-jemallocator
, which correctly uses sized deallocation (https://docs.rs/tikv-jemallocator/0.4.1/src/tikv_jemallocator/lib.rs.html#121-126).tikv-jemallocator
, as far as I can tell, is a more up-to-date set of bindings to jemalloc thanjemallocator
The perf results of this pr are in large part due to the version upgrade of jemalloc, but sized deallocation has a non-trivial improvement, particularly to rustdoc.
This pr also includes changes to bootstrap to correctly pass the jemalloc feature through to the rustdoc build