Help test out ThinLTO!

So I tried my rust-doom repo.

TL;DR thinlto regresses build times by 32% (compared to 1cgu), with no difference in runtime :frowning:

debug 1cgu debug 16cgu release 1cgu release 16cgu release 16cgu + thinlto
build #1 332.07 303.45 645.45 585.93 874.60
build #2 329.96 302.81 654.78 592.34 850.25
runtime #1 9.28 9.12 1.03 1.24 1.06
runtime #2 9.33 9.15 1.13 1.21 1.12

So adding -C codegen-units=16 speeds up the build by ~10% but increases run time by about ~13%.

Adding thinlto brings back the runtime to the same speed, but the builds actually take longer by 32% than not using codegen units at all (and by 46% compared to 16 CGU and no thinlto).

Ages ago (well two years) Niko asked me to create a branch with zero dependencies, ripping out graphics and all that, to use as a rustc benchmark. That code has rotted (and has been broken by (stable!) rustc upgrades), I could do the same thing again with the newest version of the repo if that would be useful.

Raw data:

git clone https://github.com/cristicbz/rust-doom
git checkout 51e88df

nightly: rustc 1.22.0-nightly (150b625a0 2017-10-08)

build:
  debug:
    cargo +nightly build  332.07s user 14.08s system 488% cpu 1:10.81 total
    cargo +nightly build  329.96s user 14.31s system 480% cpu 1:11.58 total

  debug+cgu:
    RUSTFLAGS='-C codegen-units=16' cargo +nightly build  303.45s user 12.15s system 479% cpu 1:05.86 total
    RUSTFLAGS='-C codegen-units=16' cargo +nightly build  302.81s user 12.19s system 487% cpu 1:04.61 total

  release:
    cargo +nightly build --release  645.45s user 8.63s system 347% cpu 3:08.11 total
    cargo +nightly build --release  654.78s user 8.48s system 364% cpu 3:01.90 total

  release+cgu:
    RUSTFLAGS='-C codegen-units=16' cargo +nightly build --release  585.93s user 8.90s system 543% cpu 1:49.39 total
    RUSTFLAGS='-C codegen-units=16' cargo +nightly build --release  592.34s user 9.07s system 532% cpu 1:52.95 total

  release+thinlto:
    RUSTFLAGS='-C codegen-units=16 -Z thinlto' cargo +nightly build --release  874.60s user 10.57s system 571% cpu 2:34.96total
    RUSTFLAGS='-C codegen-units=16 -Z thinlto' cargo +nightly build --release  850.25s user 9.64s system 576% cpu 2:29.06 total

runtime:
  debug:
    target/debug/rs_doom -i ~/data/DOOM2.WAD --check  9.28s user 0.14s system 96% cpu 9.710 total
    target/debug/rs_doom -i ~/data/DOOM2.WAD --check  9.33s user 0.06s system 99% cpu 9.406 total

  debug+cgu:
    target/debug/rs_doom -i ~/data/DOOM2.WAD --check  9.12s user 0.07s system 99% cpu 9.213 total
    target/debug/rs_doom -i ~/data/DOOM2.WAD --check  9.15s user 0.06s system 99% cpu 9.266 total

  release:
    target/release/rs_doom -i ~/data/DOOM2.WAD --check  1.03s user 0.07s system 85% cpu 1.277 total
    target/release/rs_doom -i ~/data/DOOM2.WAD --check  1.13s user 0.06s system 82% cpu 1.445 total

  release+cgu:
    target/release/rs_doom -i ~/data/DOOM2.WAD --check  1.24s user 0.06s system 84% cpu 1.535 total
    target/release/rs_doom -i ~/data/DOOM2.WAD --check  1.21s user 0.08s system 84% cpu 1.532 total

  release+thinlto:
    target/release/rs_doom -i ~/data/DOOM2.WAD --check  1.06s user 0.05s system 86% cpu 1.282 total
    target/release/rs_doom -i ~/data/DOOM2.WAD --check  1.12s user 0.06s system 87% cpu 1.348 total
6 Likes