-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
In attempting to find some local hot spots in rustc I've been playing around with various benchmarks. If you use this script to generate a Rust and a C file (which should be equivalent)
N=200000
echo > lots-of-used.rs
for i in `seq 1 $N`; do
echo "pub fn foo$i() {}" >> lots-of-used.rs
done
echo 'fn main() {' >> lots-of-used.rs
for i in `seq 1 $N`; do
echo "foo$i();" >> lots-of-used.rs
done
echo '}' >> lots-of-used.rs
echo > lots-of-used.c
for i in `seq 1 $N`; do
echo "static void foo$i() {}" >> lots-of-used.c
done
echo 'void foo() {' >> lots-of-used.c
for i in `seq 1 $N`; do
echo "foo$i();" >> lots-of-used.c
done
echo '}' >> lots-of-used.c
I've benchmarked with:
$ rustc +beta -V
rustc 1.20.0-beta.1 (e93aa3aa8 2017-07-18)
$ sh foo.sh
$ time clang -c lots-of-used.c
clang -c lots-of-used.c 14.90s user 0.36s system 99% cpu 15.259 total
$ time rustc +beta lots-of-used.rs --emit obj --crate-type rlib
rustc +beta lots-of-used.rs --emit obj --crate-type rlib 49.62s user 37.03s system 99% cpu 1:26.96 total
The -Z time-passes
output is particularly illuminating, the highest portions being:
time: 57.439; rss: 2890MB translation
time: 51.813; rss: 2497MB translation item collection
time: 10.094; rss: 534MB LLVM passes
time: 9.238; rss: 536MB codegen passes [1]
time: 5.100; rss: 2405MB borrow checking
time: 4.029; rss: 1656MB item-bodies checking
time: 2.166; rss: 1781MB const checking
time: 1.543; rss: 1069MB wf checking
It looks like the main slowdown of the the translation item collection is related to the ElaborateDrops
pass?
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.