-
Notifications
You must be signed in to change notification settings - Fork 46
Add --strip
flag
#36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@marcospb19 Thanks a lot for creating the issue! As we use the We wouldn't want to regress on performance noticeably, so if it's slow enough we would need an opt-in flag as you say. But perhaps we can use some default settings in the generated |
This may be easier now with Rust 1.58. rust-lang/cargo#10088 $ rust-script --clear-cache hello.rs
Hello world!
$ du $binary
3.5M /home/misawa/.cache/rust-script/binaries/release/hello_a747a1cd4da230aa9a6bb068
$ RUSTFLAGS="-C strip=symbols" rust-script --clear-cache hello.rs
Hello world!
$ du $binary
300K /home/misawa/.cache/rust-script/binaries/release/hello_a747a1cd4da230aa9a6bb068
$ hyperfine 'rust-script --clear-cache hello.rs' 'RUSTFLAGS="-C strip=symbols" rust-script --clear-cache hello.rs' --warmup 10
Benchmark 1: rust-script --clear-cache hello.rs
Time (mean ± σ): 593.7 ms ± 5.5 ms [User: 502.0 ms, System: 101.8 ms]
Range (min … max): 582.2 ms … 602.5 ms 10 runs
Benchmark 2: RUSTFLAGS="-C strip=symbols" rust-script --clear-cache hello.rs
Time (mean ± σ): 577.6 ms ± 10.2 ms [User: 485.7 ms, System: 100.3 ms]
Range (min … max): 566.7 ms … 597.7 ms 10 runs
Summary
'RUSTFLAGS="-C strip=symbols" rust-script --clear-cache hello.rs' ran
1.03 ± 0.02 times faster than 'rust-script --clear-cache hello.rs'
hyperfine 'rust-script --clear-cache hello.rs' --warmup 10 19.98s user 4.23s system 101% cpu 23.806 total |
Actually maybe it'll be even easier when rust-lang/cargo#10217 become usable, which allows us to specify [profile.release]
rustflags = ["-C", "strip=symbols"] |
Nice points. Sorry, I know I previously said I was willing to implement it, but I have not found the time to dedicate to open source. I'll pass this to anyone who wants to solve it. |
The
--strip
flag would strip the binary right after compiling it, which increases the time of compiling but reduces the binary size.A
println!("Hello World!")
program, for example:(I'm willing to implement it.)
The text was updated successfully, but these errors were encountered: