问题描述
构建时间较长,文件较大
Finished dev [unoptimized + debuginfo] target(s) in 24.36s
real 0m24.724s
user 0m10.158s
sys 0m2.687s
ubuntu@VM-12-10-ubuntu:~/test/tauri-app/src-tauri$ ls -lih target/debug/tauri-app
3422467 -rwxrwxr-x 2 ubuntu ubuntu 360M Nov 11 16:41 target/debug/tauri-app
默认参数
https://doc.rust-lang.org/cargo/reference/profiles.html
[profile.dev]
opt-level = 0
debug = true
strip = false #这一句是我补充的
split-debuginfo = '...' # Platform-specific. 这一句需要删除
debug-assertions = true
overflow-checks = true
lto = false
panic = 'unwind'
incremental = true
codegen-units = 256
rpath = false
优化
只需调整 debug = true
,增量编译时间大幅减少,可执行文件也大幅变小:
Finished dev [unoptimized] target(s) in 11.13s
real 0m11.210s
user 0m7.070s
sys 0m1.560s
ubuntu@VM-12-10-ubuntu:~/test/tauri-app/src-tauri$ ls -lih target/debug/tauri-app
3421917 -rwxrwxr-x 2 ubuntu ubuntu 26M Nov 11 16:29 target/debug/tauri-app
在此基础上设置 strip = true
,得到更进一步优化:
Finished dev [unoptimized] target(s) in 10.62s
real 0m10.699s
user 0m6.939s
sys 0m1.656s
ubuntu@VM-12-10-ubuntu:~/test/tauri-app/src-tauri$ ls -lih target/debug/tauri-app
3422828 -rwxrwxr-x 2 ubuntu ubuntu 16M Nov 11 16:35 target/debug/tauri-app
ubuntu@VM-12-10-ubuntu:~/test/tauri-app/src-tauri$
标签:可执行文件,target,app,Ubuntu,tauri,ubuntu,debug,true
From: https://www.cnblogs.com/develon/p/16880959.html