New release for mlar 1.3 including performance improvements
enhancementmlar
It would be beneficial to produce a new release of mlar that includes new compilation options in order to improve the program's performance. Below is a benchmark showing how performance evolves depending on the compilation options used.
### Impact of `opt-level` in `Cargo.toml`
Bench for static binaries in `release` mode using `cargo build --release --target=x86_64-unknown-linux-musl`:
```bash
$ dd if=/dev/urandom of=bench.bin bs=128MiB count=1
hyperfine \
--command-name "mlar-github" "./mlar-linux-static-v1.3.0 create -p key.pub -l encrypt -o mlar-github.mla bench.bin" \
--command-name "mlar-static-z" "./mlar-static-opt-z create -p key.pub -l encrypt -o mlar-static-opt-z.mla bench.bin" \
--command-name "mlar-static-opt-3" "./mlar-static-opt-3 create -p key.pub -l encrypt -o mlar-static-opt-3.mla bench.bin" \
--command-name "mlar-static-opt-3-native" "./mlar-static-opt-3-native create -p key.pub -l encrypt -o mlar-static-opt-3-native.mla bench.bin"
Benchmark 1: mlar-github
Time (mean ± σ): 1.095 s ± 0.028 s [User: 0.910 s, System: 0.161 s]
Range (min … max): 1.050 s … 1.147 s 10 runs
Benchmark 2: mlar-static-opt-z
Time (mean ± σ): 1.051 s ± 0.029 s [User: 0.895 s, System: 0.137 s]
Range (min … max): 0.994 s … 1.094 s 10 runs
Benchmark 3: mlar-static-opt-3
Time (mean ± σ): 389.3 ms ± 28.6 ms [User: 240.3 ms, System: 125.7 ms]
Range (min … max): 333.1 ms … 426.5 ms 10 runs
Benchmark 4: mlar-static-opt-3-native
Time (mean ± σ): 317.1 ms ± 16.7 ms [User: 182.5 ms, System: 122.5 ms]
Range (min … max): 279.5 ms … 347.0 ms 10 runs
Summary
mlar-static-opt-3-native ran
1.23 ± 0.11 times faster than mlar-static-opt-3
3.31 ± 0.20 times faster than mlar-static-opt-z
3.45 ± 0.20 times faster than mlar-github
```
Native binary has been compiled using: `RUSTFLAGS="-Ctarget-cpu=native" cargo build --release --target=x86_64-unknown-linux-musl`.
1 条评论