cargo install cargo-watch
cargo watch -x run
cargo build --release
# Cargo.toml
[profile.release]
strip = true
# Cargo.toml
[profile.release]
opt-level = "s"
Warn: Longer linking time
# Cargo.toml
[profile.release]
lto = true
Warn: Longer compile time
# Cargo.toml
[profile.release]
codegen-units = 1
Note: binary must contain symbols (strip = false)
cargo build --release
cargo bloat --release --crates
Bulding and especially testing can depleat memory and froze the OS. Limiting maximum used threads can avoid this.
# limit building to 4 threads
cargo build -j 4
# or
cargo build --jobs 4
# limit testing to 4 threads
cargo test -j 4
# or
cargo test --jobs 4