Skip to content

Regression in compile times after LLVM was upgraded #31435

Closed
@alexcrichton

Description

@alexcrichton

LLVM was recently upgraded in #30448 which appears to have caused a regression
in compile times. First up, let's talk numbers. The compiler revisions in
question are:

  • 074f49a - just before the LLVM upgrade
  • 303892e - just after the LLVM upgrade

The nightly-2016-01-30 toolchain conveniently corresponds exactly to
303892e. The benchmarks here will all be
compiling libsyntax at these two revision in optimized mode. Note that
libsyntax did not change at all between these two revisions. For local
compilations I configured with:

./configure --enable-rpath --disable-optimize-tests --enable-ccache

and the C++ compiler version is:

$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Nightly compiler (nightly-2016-01-30)

$ multirust run nightly-2016-01-30 rustc -vV
rustc 1.8.0-nightly (303892ee1 2016-01-30)
$ time multirust run nightly-2016-01-30 rustc src/libsyntax/lib.rs -O > out
multirust run nightly-2016-01-30 rustc src/libsyntax/lib.rs -O -Z time-passes  129.85s user 1.31s system 99% cpu 2:11.18 total

Summary: 2:11.18s compile time, full output of time-passes

Locally compiled after LLVM upgrade (303892e)

$ ./x86_64-unknown-linux-gnu/stage2/bin/rustc -V
rustc 1.8.0-dev (303892ee1 2016-01-30)
$ time ./x86_64-unknown-linux-gnu/stage2/bin/rustc src/libsyntax/lib.rs -O -Z time-passes > out
./x86_64-unknown-linux-gnu/stage2/bin/rustc src/libsyntax/lib.rs -O -Z  > out  96.16s user 1.29s system 99% cpu 1:37.48 total

Summary: 1:37.48s compile time, full output of time-passes

Locally compiled before LLVM upgrade (074f49a)

$ ./x86_64-unknown-linux-gnu/stage2/bin/rustc -V
rustc 1.8.0-dev (074f49a35 2016-01-29)
$ time ./x86_64-unknown-linux-gnu/stage2/bin/rustc src/libsyntax/lib.rs -O -Z time-passes > out
./x86_64-unknown-linux-gnu/stage2/bin/rustc src/libsyntax/lib.rs -O -Z  > out  81.39s user 1.28s system 99% cpu 1:22.69 total

Summary: 1:22.69s compile time, full output of time-passes

Summary

So there are some fascinating data points here:

  • The nightlies we're shipping are 35% slower than a locally compiled copy -- Edit: nightly has LLVM assertions enabled where my local compilers did not
  • The LLVM upgrade made compilation 18% slower
  • Almost the entire compile time difference can be attributed to LLVM

Ok, so something looks clearly suspicious with LLVM! Let's try and take a closer
look. First, some data dumps of -Z time-llvm-passes

Unfortunately I don't have much of a takeaway from this. Maybe others might
thought?

Next steps

  • Should we revert the LLVM upgrade? This would unfortunately not be trivial.
  • Is there something here we can report to upstream LLVM? Is there a bug fix we
    can include in our local LLVM fork temporarily?
  • Is this analysis a red herring and perhaps there's something else going on
    here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-compiletimeIssue: Problems and improvements with respect to compile times.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions