Skip to content

Running rustc -vV is slow #49761

@matklad

Description

@matklad

Hi! At Cargo, we are observing a regression in no-op builds from 1.18.0 to current stable. Looks like a significant portion of slowness can be attributed to regression in rustc itself. In particular, Cargo invokes

rustc -vV

and

rustc --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg

commands, and they both appear to have become significantly slower over time:

~/trash/foo master*
λ time rustc +stable -Vv
rustc 1.25.0 (84203cac6 2018-03-25)
binary: rustc
commit-hash: 84203cac67e65ca8640b8392348411098c856985
commit-date: 2018-03-25
host: x86_64-unknown-linux-gnu
release: 1.25.0
LLVM version: 6.0
rustc +stable -Vv  0.10s user 0.01s system 90% cpu 0.126 total

~/trash/foo master*
λ time rustc +1.18.0 -Vv
rustc 1.18.0 (03fc9d622 2017-06-06)
binary: rustc
commit-hash: 03fc9d622e0ea26a3d37f5ab030737fcca6928b9
commit-date: 2017-06-06
host: x86_64-unknown-linux-gnu
release: 1.18.0
LLVM version: 3.9
rustc +1.18.0 -Vv  0.04s user 0.01s system 99% cpu 0.047 total
λ time rustc +stable x --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg
___
lib___.rlib
lib___.so
lib___.so
lib___.a
lib___.so
/home/matklad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu
debug_assertions
proc_macro
target_arch="x86_64"
target_endian="little"
target_env="gnu"
target_family="unix"
target_os="linux"
target_pointer_width="64"
unix
rustc +stable x --crate-name ___ --print=file-names --crate-type bin  rlib     0.09s user 0.01s system 88% cpu 0.105 total

λ time rustc +1.18.0 x --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg
___
lib___.rlib
lib___.so
lib___.so
lib___.a
lib___.so
/home/matklad/.rustup/toolchains/1.18.0-x86_64-unknown-linux-gnu
debug_assertions
proc_macro
target_arch="x86_64"
target_endian="little"
target_env="gnu"
target_family="unix"
target_os="linux"
target_pointer_width="64"
unix
rustc +1.18.0 x --crate-name ___ --print=file-names --crate-type bin  rlib     0.03s user 0.01s system 99% cpu 0.039 total

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-performanceWorking group: Compiler Performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions