Description
Spawned off of #56736 (comment)
Executive summary: I want the out of the box experience for a locally-built rustc
(assuming one has optimizations on and debug off) to be as close as possible to what you get from the CI-built distribution of rustc
.
With respect to jemalloc, the above goals means we should either: 1. turn rustc.jemalloc
on by default in the build config, or 2. turn rustc.jemalloc
off in the CI (after perhaps evaluating whether the CI can use a newer glibc, which I hear may have performance more comparable to what jemalloc achieves).
However, it may be that others disagree with my overall goal (about out-of-the-box experience), and that there is never any substitute for finding out what the actual configure
arguments are for one's platform. (In which case I think we should revise the rustc-guide to more prominently feature how one inspects the .yml files to find the configure arguments for a platform. Yuck.)
More explanation/discussion follows below.
As of PR #55238 (resolving issue #36963), builds of rustc
stopped linking in jemalloc
by default; however, if I am correctly reading the documentation and commit messages of that PR, the rustc
built via CI opts back into having jemalloc
linked to rustc
(on Linux or Mac OS X). (and thus the nightly you get via rustup
or otherwise downloading CI-built executables will link to jemalloc
).
Its a pretty confusing situation, in my opinion, since attempts to locally replicate the behavior described here via a local build of rustc
would need to turn that flag back on.
(Also: the CI's opting back into using jemalloc
affects not just the nightly builds but also the beta and stable ones......?)
On the aforementioned comment thread, @gnzlbg added:
IIUC the intent was for
rustc
to always depend onjemalloc
by default, since that was the status-quo before that change, but to allow people to build it withoutjemalloc
, e.g., if they want to use it in a system wherejemalloc
is not available. It might be that this did not fully materialize.
So at first my question was: Why do we not just make rustc.jemalloc
true by default?
But then I reviewed PR #55238, and I think I might have found the answer to that question:
- We definitely do not want to link in
jemalloc
on platforms other than Linux/OSX by default. - I had originally thought that the semantics of
rustc.jemalloc
was that it had no effect unless you were on Linux/OSX. - But after reviewing the PR, I am now thinking that while the correctness of code of code like this is dependent on being on either Linux or Mac OS X, that does not mean such code behaves as a no-op on other platforms.
- Therefore, the way things currently stand, achieving my goal of parity-with-CI-by-default will not accomplished by simply making
rustc.jemalloc
true by default. I think we would have to also "fix" things so that that flag also behaves as a no-op on platforms other than Linux or Mac OS X.
Having said all that: I want the out of the box experience for a locally-built rustc
(assuming one has optimizations on and debug off) to be as close as possible to what the CI gives you. I assume that others see the value in that objective...?