Skip to content

Commit 3a7aa6c

Browse files
committed
Reduce time required to build from scratch in dev mode
* Disable wasm reading of object * Use tempfile bundled with rustc * Don't optimize and don't generate debuginfo for build scripts and some build deps Before: 354s (5m 45s) After: 207s (3m 27s)
1 parent f2c574a commit 3a7aa6c

File tree

3 files changed

+30
-120
lines changed

3 files changed

+30
-120
lines changed

Cargo.lock

Lines changed: 0 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ ar = "0.8.0"
2222
bitflags = "1.1.0"
2323
byteorder = "1.2.7"
2424
libc = "0.2.53"
25-
tempfile = "3.0.7"
2625
gimli = { git = "https://github.com/gimli-rs/gimli.git" }
2726
indexmap = "1.0.2"
28-
object = "0.14.0"
2927
libloading = "0.5.1"
3028

29+
[dependencies.object]
30+
version = "0.14.0"
31+
default-features = false
32+
features = ["compression", "read", "std"] # We don't need WASM support
33+
3134
# Uncomment to use local checkout of cranelift
3235
#[patch."https://github.com/CraneStation/cranelift.git"]
3336
#cranelift = { path = "../cranelift/cranelift-umbrella" }
@@ -41,5 +44,28 @@ libloading = "0.5.1"
4144
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
4245
cranelift-simplejit = { git = "https://github.com/CraneStation/cranelift.git" }
4346

44-
[profile.dev.overrides."*"]
47+
[profile.dev]
48+
# By compiling dependencies with optimizations, performing tests gets much faster.
4549
opt-level = 3
50+
51+
[profile.dev.overrides."rustc_codegen_cranelift"]
52+
# Disabling optimizations for cg_clif itself makes compilation after a change faster.
53+
opt-level = 0
54+
55+
# Disable optimizations and debuginfo of build scripts and some of the heavy build deps, as the
56+
# execution time of build scripts is so fast that optimizing them slows down the total build time.
57+
[profile.dev.build-override]
58+
opt-level = 0
59+
debug = false
60+
61+
[profile.dev.overrides.cranelift-codegen-meta]
62+
opt-level = 0
63+
debug = false
64+
65+
[profile.dev.overrides.syn]
66+
opt-level = 0
67+
debug = false
68+
69+
[profile.dev.overrides.synstructure]
70+
opt-level = 0
71+
debug = false

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(intra_doc_link_resolution_failure)]
33

44
extern crate flate2;
5+
extern crate tempfile;
56
extern crate rustc;
67
extern crate rustc_codegen_ssa;
78
extern crate rustc_codegen_utils;

0 commit comments

Comments
 (0)