Skip to content
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

mv std libs to library/ #73265

Merged
merged 1 commit into from
Jul 28, 2020
Merged

mv std libs to library/ #73265

merged 1 commit into from
Jul 28, 2020

Conversation

mark-i-m
Copy link
Member

@mark-i-m mark-i-m commented Jun 12, 2020

This is the first step in refactoring the directory layout of this repository, with further followup steps planned (but not done yet).

Background: currently, all crates are under src/, without nested src directories and with the unconventional lib* prefixes (e.g., src/libcore/lib.rs). This directory structures is not idiomatic and makes the src/ directory rather overwhelming. To improve contributor experience and make things a bit more approachable, we are reorganizing the repo a bit.

In this PR, we move the standard libs (basically anything that is "runtime", as opposed to part of the compiler, build system, or one of the tools, etc). The new layout moves these libraries to a new library/ directory in the root of the repo. Additionally, we remove the lib* prefixes and add nested src/ directories. The other crates/tools in this repo are not touched. So in summary:

library/<crate>/src/*.rs
src/<all the rest>     // unchanged

where <crate> is:

  • core
  • alloc
  • std
  • test
  • proc_macro
  • panic_abort
  • panic_unwind
  • profiler_builtins
  • term
  • unwind
  • rtstartup
  • backtrace
  • rustc-std-workspace-*

There was a lot of discussion about this and a few rounds of compiler team approvals, FCPs, MCPs, and nominations. The original MCP is rust-lang/compiler-team#298. The final approval of the compiler team was given here: #73265 (comment).

The name library was chosen to complement a later move of the compiler crates to a compiler/ directory. There was a lot of discussion around adding the nested src/ directories. Note that this does increase the nesting depth (plausibly important for manual traversal of the tree, e.g., through GitHub's UI or cd), but this is deemed to be better as it fits the standard layout of Rust crates throughout most of the ecosystem, though there is some debate about how much this should apply to multi-crate projects. Overall, there seem to be more people in favor of nested src/ than against.

After this PR, there are no dependencies out of the library/ directory except on the build_helper (or crates.io crates).

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 12, 2020
@mark-i-m mark-i-m marked this pull request as ready for review June 12, 2020 02:36
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux mingw-check
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 9'
Agent machine name: 'fv-az578'
Current agent version: '2.170.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200604.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200604.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.3)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/b4e86171-49ed-4f6b-aeaf-d94c9e731aac.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/73265/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/73265/merge:refs/remotes/pull/73265/merge
---
 ---> f883e675ad62
Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
 ---> Using cache
 ---> c0b156eb069c
Step 7/7 : ENV SCRIPT python3 ../x.py test src/tools/expand-yaml-anchors &&            python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python3 ../x.py build --stage 0 src/tools/build-manifest &&            python3 ../x.py test --stage 0 src/tools/compiletest &&            python3 ../x.py test src/tools/tidy &&            python3 ../x.py doc --stage 0 src/libstd &&            /scripts/validate-toolstate.sh
 ---> 8541bab6b38c
Successfully built 8541bab6b38c
Successfully tagged rust-ci:latest
Built container sha256:8541bab6b38c07f1b7eb787539b9cbe93daa6ac4458d3d7bd8a8921622a14ba1
---
    Checking rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
    Checking chalk-rust-ir v0.10.0
    Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
    Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
    Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
    Checking chalk-solve v0.10.0
    Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
    Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
    Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
configure: rust.verify-llvm-ir  := True
configure: build.submodules     := False
configure: llvm.ccache          := sccache
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
Hugepagesize:       2048 kB
DirectMap4k:      133056 kB
DirectMap2M:     5109760 kB
DirectMap1G:     4194304 kB
+ python3 ../x.py test src/tools/expand-yaml-anchors
Ensuring the YAML anchors in the GitHub Actions config were expanded
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building stage0 tool expand-yaml-anchors (x86_64-unknown-linux-gnu)
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.11
   Compiling linked-hash-map v0.5.2
   Compiling lazy_static v1.4.0
   Compiling lazy_static v1.4.0
   Compiling yaml-rust v0.4.3
   Compiling quote v1.0.2
   Compiling thiserror-impl v1.0.5
   Compiling thiserror v1.0.5
   Compiling yaml-merge-keys v0.4.0
   Compiling expand-yaml-anchors v0.1.0 (/checkout/src/tools/expand-yaml-anchors)
Build completed successfully in 0:00:30
+ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu
    Finished dev [unoptimized] target(s) in 0.18s
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> i686-pc-windows-gnu)
---
    Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
    Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
    Checking chalk-rust-ir v0.10.0
    Checking rustc_session v0.0.0 (/checkout/src/librustc_session)
    Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
    Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
    Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
    Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
    Checking rustc_ast_passes v0.0.0 (/checkout/src/librustc_ast_passes)
---
tidy check
* 604 error codes
* highest error code: E0762
* 289 features
thread 'main' panicked at 'assertion failed: saw_target_arch', src/tools/tidy/src/pal.rs:104:5



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
Build completed unsuccessfully in 0:00:32
Build completed unsuccessfully in 0:00:32
== clock drift check ==
  local time: Fri Jun 12 03:15:09 UTC 2020
  network time: Fri, 12 Jun 2020 03:15:09 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/73265/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/73265/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3714) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jun 12, 2020

☔ The latest upstream changes (presumably #69478) made this pull request unmergeable. Please resolve the merge conflicts.

@petrochenkov
Copy link
Contributor

std won't be inside src? Why?

If we move the compiler crates into a directory as well, I'd expect the result to look roughly like this

├── src
│   ├── bootstrap
│   ├── build_helper
│   ├── ci
│   ├── doc
│   ├── etc
│   ├── librustdoc
│   ├── llvm-project
│   ├── rustc
│   ├── std
│   ├── test
│   ├── tools
│   ├── README.md
│   └── stage0.txt

, i.e. all the high-level components at one level.

@mark-i-m
Copy link
Member Author

I guess the idea was to move towards a world where std doesn't use x.py, e.g. we would later rename src to "rustc" or something... so i prefer to have different top-level directories.

I'm ok with your proposal too, but the original mcp never mentioned moving all of the rustc crates one level deeper into another directory, which seems not as desirable...

Also worth mentioning: @matklad proposed naming it "rt" (runtime) instead of "std"... still not really sure how i feel though.

@Mark-Simulacrum
Copy link
Member

Well, no, the idea is that it's currently true that rust-lang/rust is somewhat unique in its directory structure. I would personally like to move to a world where we have more than just src at the top-level, e.g. we'd have something like this:

  • std/<crate>/src/*.rs
  • compiler/<crate>/src/*.rs
  • tools/<crate>/src/*.rs
  • ci/

As I understand it, one of the survey results was that people felt overwhelmed navigating in the repository, as there's just so many crates all at the same level. A structure like this would hopefully help with that, at least easing people into the right "tree" of crates. Potentially each of these would also be its own workspace, to help with building things via normal Cargo, but that can be left to the future.

@petrochenkov
Copy link
Contributor

All the high-level components in the root instead of src should also be ok.

Having a single directory with sources is convenient for things like git clean though.
(The root directory can contain build directory and other things like this.)

@Mark-Simulacrum
Copy link
Member

I expect that most people will be touching only one of the root directories in any given PR (exceptions, of course, will exist). Hopefully that means that git clean's functionality still mostly works and this isn't too big a hit in that sense.

The primary objection I've heard to this structure is that it adds a nesting layer we're currently missing (i.e., one more directory to descend down). I think that's inevitable if we keep the src/ directory in each crate (which makes the layout match all other Cargo projects), but we could omit that to keep the same amount of nesting as we have today. I'm personally in favor of keeping the src/ directory to try and match what other Cargo-based projects do.

To be clear, though, I believe in this PR the intent is to only move the standard library and related ("runtime", I guess) crates into a top-level std directory with a nested src/, I believe (i.e., src/libcore/ptr/mod.rs -> std/libcore/src/ptr/mod.rs). In the future we may open another MCP to do so for the other crates in src/.

@petrochenkov
Copy link
Contributor

@mark-i-m
All this stuff

├── libpanic_abort
├── libpanic_unwind
├── libprofiler_builtins
├── libterm
├── libunwind
├── rtstartup

is also standard library.
(At least to the same extent as libcore, or more.)

@petrochenkov
Copy link
Contributor

petrochenkov commented Jun 12, 2020

Also worth mentioning: @matklad proposed naming it "rt" (runtime) instead of "std"... still not really sure how i feel though.

Bikeshed warning.

The naming can be based either on what the things do

compiler
library
compiler
runtime
compiler
stdlib (or standard_library, but that's too long)

or on how the are named (which compiler? which library?)

rustc
std (but also includes proc_macro and test, which are not parts of std or its dependencies)

I'm not sure what I prefer, but the choice should probably be consistent at least.

@Mark-Simulacrum
Copy link
Member

rustc + std seems like a good pairing, when we get to that point. In particular, I think "runtime" I'm not a fan of because it's not immediately discoverable -- most people are "surprised" in some sense to hear that Rust has a runtime -- and the runtime is really not all of std (much less test etc).

@petrochenkov
Copy link
Contributor

petrochenkov commented Jun 12, 2020

One more suggestion - introduce inner src directories for the standard library crates in the same PR (and commit?) with moving to std to avoid losing git history twice.

@Mark-Simulacrum
Copy link
Member

Yes, same commit would be necessary. Git history should be mostly preserved with --follow though I think as we're not changing the files at all just renaming them (and git is pretty good about tracking that I think?)

I do think that we should only move the files once regardless, in this PR.

@mark-i-m

This comment has been minimized.

@Mark-Simulacrum
Copy link
Member

We do change the nesting depth, though, as previously there was no std directory in the path. IMO, that's a worthwhile trade-off, but I know that @bjorn3 and @lcnr felt differently. I don't really know how to try to deal with their objections, though, beyond just not adding the additional directory.

Personally, I weigh the "standard layout" as more important than saving a click when navigating the tree on GitHub... but I guess that the calculus can reasonably be different from others. Maybe someone on T-compiler proper should make the call, or we can have another dedicated MCP (though I expect it to go equivalently).

@matklad
Copy link
Member

matklad commented Jun 13, 2020

As a data point, rust-analyzer uses the equivalently deep layout with „useless“ src, /crates/foo/src/lib.rs, and so far nobody actively complained about that.

@petrochenkov
Copy link
Contributor

VSCode uses a file search that is fuzzy enough to turn resolve/lib.rs into resolve/src/lib.rs in "Go to file", so I guess people using VSCode and "Go to file" for opening files (e.g. me) won't be affected much.

src/bootstrap/dist.rs Outdated Show resolved Hide resolved
src/bootstrap/dist.rs Outdated Show resolved Hide resolved
src/bootstrap/doc.rs Outdated Show resolved Hide resolved
src/tools/tidy/src/pal.rs Outdated Show resolved Hide resolved
std/libstd/Cargo.toml Outdated Show resolved Hide resolved
@mark-i-m
Copy link
Member Author

@rustbot modify labels: +I-nominated

Nominating for discussion to get consensus on this proposal: #73265 (comment)

@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2020

Error: Label I-nominated can only be set by Rust team members

Please let @rust-lang/release know if you're having trouble with this bot.

@spastorino spastorino added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 17, 2020
@mark-i-m
Copy link
Member Author

mark-i-m commented Jul 28, 2020

I mean, I don't think Niko has that much on his plate 😛

bors bot added a commit to japaric/xargo that referenced this pull request Jul 29, 2020
301: fix for changed rustc directory layout r=RalfJung a=RalfJung

This fixes xargo to work with rust-lang/rust#73265.
We should wait until the next nightly is released so that CI tests a nightly with the new directories.

Co-authored-by: Ralf Jung <[email protected]>
bors added a commit to rust-lang/miri that referenced this pull request Jul 29, 2020
rustup for new folder layout

Fixes the fallout from rust-lang/rust#73265.

Blocked on a xargo release with japaric/xargo#301.
@Mark-Simulacrum
Copy link
Member

Perf triage:

This was a slight regression. This seems unexpected. Perhaps metadata sizes increased so we're reading more from disk? It would be good to investigate this further.

@mark-i-m
Copy link
Member Author

mark-i-m commented Aug 3, 2020

I don't know what to make of this other than maybe we messed up the layout of something in the processor caches? Where would one even start to debug something like this?

@Mark-Simulacrum
Copy link
Member

My guess is that someone with pretty decent hardware, just to avoid it being really painful, would need to build rustc before/after this PR, i.e., on 9be8ffc and ac48e62 and run cachegrind on a rustc compilation of helloworld. The diff between those should give us a start of an idea for how to fix this.

I've added this to my todo list.

@mati865
Copy link
Contributor

mati865 commented Aug 3, 2020

Adding to my todo as well.

run cachegrind on a rustc compilation of helloworld

With default options or something specific to reduce the noise?

@Mark-Simulacrum
Copy link
Member

cachegrind diffs are usually noiseless for me, or nearly so.

@mati865
Copy link
Contributor

mati865 commented Aug 4, 2020

Looks like longer paths made hashing more expensive?

--------------------------------------------------------------------------------
Ir                file:function
--------------------------------------------------------------------------------
232,500 (38.13%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/md-5-0.8.0/src/utils.rs:md5::utils::compress
208,125 (34.14%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:md5::utils::compress
-38,140 (-6.26%)  ???:_int_malloc
 35,188 ( 5.77%)  /home/mateusz/Projects/rust/rust/library/std/src/path.rs:<std::path::Components as core::iter::traits::iterator::Iterator>::next
 30,410 ( 4.99%)  /home/mateusz/Projects/rust/rust/library/core/src/slice/memchr.rs:core::slice::memchr::memchr
 21,507 ( 3.53%)  /home/mateusz/Projects/rust/rust/library/core/src/str/mod.rs:core::str::from_utf8
 15,454 ( 2.53%)  /home/mateusz/Projects/rust/rust/src/librustc_data_structures/sip128.rs:_ZN89_$LT$rustc_data_structures..stable_hasher..StableHasher$u20$as$u20$core..hash..Hasher$GT$5writeN.llvm.M
 14,497 ( 2.38%)  /home/mateusz/Projects/rust/rust/src/librustc_data_structures/sip128.rs:<std::path::Path as core::hash::Hash>::hash
 14,139 ( 2.32%)  ???:llvm::PMTopLevelManager::findAnalysisPassInfo(void const*) const
 12,002 ( 1.97%)  /home/mateusz/Projects/rust/rust/src/librustc_data_structures/sip128.rs:core::hash::impls::<impl core::hash::Hash for [T]>::hash
 11,439 ( 1.88%)  /home/mateusz/Projects/rust/rust/library/core/src/slice/mod.rs:<std::path::Components as core::iter::traits::iterator::Iterator>::next
 10,270 ( 1.68%)  ???:llvm::FoldingSetNodeID::AddPointer(void const*)
 -8,840 (-1.45%)  /home/mateusz/Projects/rust/rust/library/alloc/src/borrow.rs:alloc::borrow::Cow<B>::into_owned
  8,736 ( 1.43%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:<std::path::Path as core::hash::Hash>::hash
 -7,458 (-1.22%)  ???:unlink_chunk.constprop.0
  7,413 ( 1.22%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:core::hash::impls::<impl core::hash::Hash for [T]>::hash
  7,280 ( 1.19%)  /home/mateusz/Projects/rust/rust/library/alloc/src/vec.rs:<alloc::string::String as rustc_serialize::serialize::Decodable>::decode
 -6,696 (-1.10%)  ???:llvm::PMDataManager::initializeAnalysisImpl(llvm::Pass*)
  6,000 ( 0.98%)  ???:sysmalloc
  5,730 ( 0.94%)  ???:llvm::PMDataManager::recordAvailableAnalysis(llvm::Pass*)
 -5,720 (-0.94%)  /home/mateusz/Projects/rust/rust/library/alloc/src/vec.rs:alloc::borrow::Cow<B>::into_owned
 -5,294 (-0.87%)  ???:llvm::PassRegistry::getPassInfo(void const*) const
  5,200 ( 0.85%)  /home/mateusz/Projects/rust/rust/library/alloc/src/alloc.rs:alloc::raw_vec::RawVec<T,A>::allocate_in
  5,022 ( 0.82%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:core::slice::memchr::memchr
  5,000 ( 0.82%)  /home/mateusz/Projects/rust/rust/library/core/src/intrinsics.rs:md5::utils::compress
  4,985 ( 0.82%)  ???:llvm::PMTopLevelManager::findAnalysisUsage(llvm::Pass*)
  4,866 ( 0.80%)  /home/mateusz/Projects/rust/rust/library/std/src/path.rs:<std::path::Path as core::hash::Hash>::hash
 -4,680 (-0.77%)  /home/mateusz/Projects/rust/rust/library/alloc/src/alloc.rs:alloc::borrow::Cow<B>::into_owned
  4,063 ( 0.67%)  ???:__memset_avx2_erms
  3,676 ( 0.60%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:_ZN89_$LT$rustc_data_structures..stable_hasher..StableHasher$u20$as$u20$core..hash..Hasher$GT$5writeN.llvm.M
  2,709 ( 0.44%)  ???:llvm::PMTopLevelManager::AUFoldingSetNode::Profile(llvm::FoldingSetNodeID&, llvm::AnalysisUsage const&)
  2,640 ( 0.43%)  /home/mateusz/Projects/rust/rust/src/librustc_codegen_ssa/back/write.rs:std::sys_common::backtrace::__rust_begin_short_backtrace
 -2,585 (-0.42%)  /home/mateusz/Projects/rust/rust/src/librustc_codegen_ssa/back/write.rs:_ZN3std10sys_common9backtrace28__rust_begin_short_backtraceN.llvm.M
 -2,418 (-0.40%)  ???:llvm::PMTopLevelManager::findAnalysisPass(void const*)
  2,294 ( 0.38%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:hashbrown::raw::RawTable<T>::insert
 -2,275 (-0.37%)  ???:llvm::PMDataManager::collectRequiredAndUsedAnalyses(llvm::SmallVectorImpl<llvm::Pass*>&, llvm::SmallVectorImpl<void const*>&, llvm::Pass*)
  2,128 ( 0.35%)  /home/mateusz/Projects/rust/rust/library/core/src/slice/mod.rs:core::slice::<impl [T]>::copy_from_slice
  2,118 ( 0.35%)  /home/mateusz/Projects/rust/rust/library/core/src/hash/mod.rs:core::hash::impls::<impl core::hash::Hash for [T]>::hash
  2,080 ( 0.34%)  /home/mateusz/Projects/rust/rust/library/alloc/src/raw_vec.rs:alloc::raw_vec::RawVec<T,A>::allocate_in
  2,047 ( 0.34%)  ???:__memcpy_avx_unaligned_erms
  2,016 ( 0.33%)  ???:llvm::MCAsmLayout::ensureValid(llvm::MCFragment const*) const
  1,883 ( 0.31%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/md-5-0.8.0/src/lib.rs:<D as digest::digest::Digest>::digest
 -1,780 (-0.29%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/compiler_builtins-0.1.32/src/int/udiv.rs:compiler_builtins::int::udiv::__udivmodti4
 -1,644 (-0.27%)  ???:llvm::AttributeListImpl::Profile(llvm::FoldingSetNodeID&) const
 -1,607 (-0.26%)  ???:__strlen_avx2
 -1,560 (-0.26%)  /home/mateusz/Projects/rust/rust/library/core/src/intrinsics.rs:alloc::borrow::Cow<B>::into_owned
 -1,560 (-0.26%)  /home/mateusz/Projects/rust/rust/library/alloc/src/string.rs:alloc::borrow::Cow<B>::into_owned
  1,560 ( 0.26%)  /home/mateusz/Projects/rust/rust/library/alloc/src/raw_vec.rs:<alloc::string::String as rustc_serialize::serialize::Decodable>::decode
  1,425 ( 0.23%)  ???:realloc
  1,296 ( 0.21%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/block-buffer-0.7.3/src/lib.rs:<D as digest::digest::Digest>::digest
  1,235 ( 0.20%)  /home/mateusz/Projects/rust/rust/src/librustc_data_structures/stable_hasher.rs:_ZN89_$LT$rustc_data_structures..stable_hasher..StableHasher$u20$as$u20$core..hash..Hasher$GT$5writeN.llvm.M
 -1,222 (-0.20%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:core::str::from_utf8
  1,215 ( 0.20%)  /home/mateusz/Projects/rust/rust/library/core/src/slice/mod.rs:<core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  1,134 ( 0.19%)  ???:llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long)
  1,106 ( 0.18%)  ???:multikeySort(llvm::MutableArrayRef<std::pair<llvm::CachedHashStringRef, unsigned long>*>, int)
  1,062 ( 0.17%)  ???:__vfscanf_internal
 -1,047 (-0.17%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/bitmask.rs:hashbrown::map::HashMap<K,V,S>::insert
 -1,040 (-0.17%)  /home/mateusz/Projects/rust/rust/library/core/src/result.rs:<alloc::string::String as rustc_serialize::serialize::Decodable>::decode
  1,040 ( 0.17%)  /home/mateusz/Projects/rust/rust/library/alloc/src/string.rs:<alloc::string::String as rustc_serialize::serialize::Decodable>::decode
  1,040 ( 0.17%)  /home/mateusz/Projects/rust/rust/library/alloc/src/borrow.rs:<alloc::string::String as rustc_serialize::serialize::Decodable>::decode
   -992 (-0.16%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:hashbrown::map::HashMap<K,V,S>::insert
    912 ( 0.15%)  /home/mateusz/Projects/rust/rust/library/core/src/intrinsics.rs:core::slice::<impl [T]>::copy_from_slice
   -864 (-0.14%)  /home/mateusz/Projects/rust/rust/library/alloc/src/vec.rs:<&mut W as core::fmt::Write>::write_str
    843 ( 0.14%)  ???:llvm::PMDataManager::removeNotPreservedAnalysis(llvm::Pass*)
   -816 (-0.13%)  ???:llvm::AnalysisResolver::getAnalysisIfAvailable(void const*, bool) const
   -811 (-0.13%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/bitmask.rs:hashbrown::map::RawEntryBuilder<K,V,S>::from_key_hashed_nocheck
   -810 (-0.13%)  /home/mateusz/Projects/rust/rust/src/librustc_metadata/rmeta/decoder.rs:<core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   -808 (-0.13%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/bitmask.rs:hashbrown::map::RawEntryBuilderMut<K,V,S>::from_hash
   -774 (-0.13%)  /home/mateusz/Projects/rust/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/sse2.rs:hashbrown::map::RawEntryBuilderMut<K,V,S>::from_hash
   -772 (-0.13%)  /home/mateusz/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:hashbrown::map::RawEntryBuilderMut<K,V,S>::from_hash
   -770 (-0.13%)  /home/mateusz/Projects/rust/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/sse2.rs:hashbrown::map::HashMap<K,V,S>::insert
    744 ( 0.12%)  ???:arena_get2.part.0
   -741 (-0.12%)  ???:__strncmp_avx2
   -735 (-0.12%)  ???:llvm::DenseMapBase<llvm::DenseMap<void const*, llvm::PassInfo const*, llvm::DenseMapInfo<void const*>, llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*> >, void const*, llvm::PassInfo const*, llvm::DenseMapInfo<void const*>, llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*> >::moveFromOldBuckets(llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*>*, llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*>*)
   -733 (-0.12%)  ???:_int_free
   -720 (-0.12%)  /home/mateusz/Projects/rust/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/sse2.rs:hashbrown::map::RawEntryBuilder<K,V,S>::from_key_hashed_nocheck
   -720 (-0.12%)  ???:llvm::PassRegistry::registerPass(llvm::PassInfo const&, bool)
    706 ( 0.12%)  /home/mateusz/Projects/rust/rust/library/std/src/ffi/os_str.rs:<std::path::Path as core::hash::Hash>::hash
    699 ( 0.11%)  ???:llvm::PMTopLevelManager::setLastUser(llvm::ArrayRef<llvm::Pass*>, llvm::Pass*)
    648 ( 0.11%)  /home/mateusz/Projects/rust/rust/library/core/src/intrinsics.rs:<&mut W as core::fmt::Write>::write_str
   -639 (-0.10%)  /home/mateusz/Projects/rust/rust/library/core/src/num/mod.rs:compiler_builtins::int::udiv::__udivmodti4
    635 ( 0.10%)  /home/mateusz/Projects/rust/rust/library/core/src/slice/mod.rs:<D as digest::digest::Digest>::digest
    623 ( 0.10%)  /home/mateusz/Projects/rust/rust/library/core/src/ptr/const_ptr.rs:<D as digest::digest::Digest>::digest
    621 ( 0.10%)  ???:__memchr_avx2
    610 ( 0.10%)  ???:_int_realloc

If somebody wants to play with the raw data, here it is:
.orig files are unmodified cachegrind outputs.
before is stage2 of 9be8ffc and after is stage2 of ac48e62. They are both normalised.
cachegrind.zip

I can also upload prebuilt Rust if somebody wants.

@Mark-Simulacrum
Copy link
Member

That looks reasonable. I think the md5 hashing is presumably from encoding md5 hashes into debuginfo. Maybe we can consider some sort of partial hashing scheme -- many files are going to all be at some prefix, and we can pre-hash that prefix I guess?

Not sure how feasible such a cache would be though.

Xanewok added a commit to Xanewok/racer that referenced this pull request Sep 3, 2020
Xanewok added a commit to Xanewok/racer that referenced this pull request Sep 4, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2020
…crum

tidy: Re-enable check for inline unit tests

It regressed in rust-lang#73265 and compiler crates are no longer checked.
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.