build(lite-backend): fat LTO and one codegen unit for release builds
The qtlib wrapper's Cargo.toml, the workspace root of the backend build, had no release profile, so libsilentdragonxlite.a was built with cargo's defaults: no LTO and 16 codegen units, with the objects of every dependency copied into the archive. The release profile now sets opt-level 3, fat LTO and one codegen unit. panic stays "unwind", written out with a comment: litelib_execute turns a panic into an error through catch_unwind, and the full-tx fetcher and the threadpool turn scan-job panics into errors by unwinding. There is no strip setting: rustc does not link a staticlib, and build.sh strips the final executable. Measured, building the same source both ways: - archive: Linux 126.7 -> 71.5 MB with 1580 -> 1 Rust object files; Windows 105.9 -> 65.8 MB with 1560 -> 1; - stripped ObsidianDragonLite: Linux 84,283,856 -> 75,366,184 bytes (-8.9 MB, -10.6%); Windows exe 87,436,288 -> 79,379,968 bytes (-8.1 MB, -9.2%). On Linux .text went from 20.0 to 14.8 MB and .eh_frame from 2.67 to 1.19 MB; - exported symbols unchanged (blake3_PW and the 8 litelib_* functions); - a forced panic in the send command's JSON parsing still returns "Error: Rust panic in litelib_execute", and the next call works; - lite_smoke --restore-recent, --keys and --encrypt pass with identical output apart from chain tip and birthday; restore CPU time is unchanged within noise (115.8-117.2 s before, 111.7-118.8 s after) and peak RSS dropped from 38.5 to 31.6 MB; - backend build time: Linux 70 -> 118 s, Windows 54 -> 102 s. This has no effect on releases until the backend artifacts are rebuilt: build.sh links the prebuilt build/lite-backend/<platform> archives, which are still the old non-LTO ones (the Windows one also predates the recent backend commits). Rebuild them with scripts/build-lite-backend-artifact.sh from a clean, committed tree. Not verifiable here: on Windows only the link was checked, with no panic probe, smoke run, sync or send (inlining can grow stack frames, and mingw threads get about 2 MB of stack); the macOS artifact was not built (CARGO_PROFILE_RELEASE_LTO=thin is the fallback if fat LTO is a problem there); and a send, with its proving, needs a funded wallet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
@@ -14,3 +14,13 @@ lazy_static = "1.4.0"
|
||||
blake3 = "0.3.4"
|
||||
silentdragonxlitelib = { path = "../silentdragonxlite-cli/lib" }
|
||||
socket2 = "0.3.11"
|
||||
|
||||
# Release profile for the static library linked into the Lite app. panic MUST stay "unwind":
|
||||
# litelib_execute wraps the command in catch_unwind, and the full-tx fetcher (fulltx_fetch.rs) and
|
||||
# threadpool turn scan-job panics into errors by unwinding. Do not set panic = "abort". Do not add
|
||||
# `strip`: rustc does not link a staticlib (no-op), and build.sh strips the final executable.
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
lto = true # fat LTO; fall back to "thin" if build time/RAM is a problem
|
||||
codegen-units = 1
|
||||
panic = "unwind"
|
||||
|
||||
Reference in New Issue
Block a user