knurling-rs / flip-link

Adds zero-cost stack overflow protection to your embedded programs
Apache License 2.0
279 stars 8 forks source link

Minimize deps #32

Closed Urhengulas closed 3 years ago

Urhengulas commented 3 years ago

This PR disables the default features of the dependency object, which results in good gains in build time (debug: -2.622s; release: -3.676s) and binary size (debug: -4.6MB; release: -69.3kB) (see results below).

It also updates and upgrades the other dependencies.


# this pr
$ hyperfine -p 'cargo clean' 'cargo build' 'cargo build --release'
Benchmark #1: cargo build
  Time (mean ± σ):      6.959 s ±  0.216 s    [User: 38.446 s, System: 2.313 s]
  Range (min … max):    6.476 s …  7.200 s    10 runs

Benchmark #2: cargo build --release
  Time (mean ± σ):     12.412 s ±  0.209 s    [User: 102.318 s, System: 2.519 s]
  Range (min … max):   12.196 s … 12.907 s    10 runs

Summary
  'cargo build' ran
    1.78 ± 0.06 times faster than 'cargo build --release'

$ exa -lB target/debug/flip-link && exa -lB target/release/flip-link
.rwxr-xr-x@ 19,621,368 urhengulas 11 Apr 17:18 target/debug/flip-link
.rwxr-xr-x@ 4,460,304 urhengulas 11 Apr 17:18 target/release/flip-link

# main
$ hyperfine -p 'cargo clean' 'cargo build' 'cargo build --release'
Benchmark #1: cargo build
  Time (mean ± σ):      9.581 s ±  0.112 s    [User: 55.811 s, System: 3.263 s]
  Range (min … max):    9.355 s …  9.765 s    10 runs

Benchmark #2: cargo build --release
  Time (mean ± σ):     16.088 s ±  0.116 s    [User: 150.146 s, System: 3.622 s]
  Range (min … max):   15.909 s … 16.281 s    10 runs

Summary
  'cargo build' ran
    1.68 ± 0.02 times faster than 'cargo build --release'

$ exa -lB target/debug/flip-link && exa -lB target/release/flip-link
.rwxr-xr-x@ 24,227,272 urhengulas 11 Apr 17:18 target/debug/flip-link
.rwxr-xr-x@ 4,529,560 urhengulas 11 Apr 17:18 target/release/flip-link
Urhengulas commented 3 years ago

bors r+

bors[bot] commented 3 years ago

Build succeeded: