The renderer is GPU-bound, but Bevy's CPU path (resource management, system scheduling, egui, wgpu command submission) still benefits from cross-crate inlining. Cargo's default release profile skips LTO and splits codegen across 16 units, leaving inter-crate trampolines through Bevy/wgpu in the hot path. - lto = "fat": whole-program cross-crate inlining. - codegen-units = 1: best optimization (slower compiles, accepted). - panic = "abort": smaller binary, no unwind tables. - strip = "symbols": drop debug symbols from the shipped binary. wasm-release inherits release then overrides opt-level to "z", so web builds keep their size focus. Release build verified; cargo test green (14 passed).
41 lines
1.3 KiB
TOML
41 lines
1.3 KiB
TOML
[package]
|
|
name = "singularity-rs"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
|
|
[lib]
|
|
name = "singularity_rs"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
bevy = "0.19"
|
|
bevy_egui = "0.41"
|
|
|
|
# Web-only deps for WebGPU detection + fallback message.
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
web-sys = { version = "0.3", features = ["Gpu", "Navigator", "Window", "Document", "HtmlElement", "Element"] }
|
|
wasm-bindgen = "0.2"
|
|
js-sys = "0.3"
|
|
|
|
# Desktop release tuning. This renderer is GPU-bound, but Bevy's CPU path
|
|
# (resource management, system scheduling, egui, wgpu command submission)
|
|
# still benefits measurably from cross-crate LTO and a single codegen unit:
|
|
# - lto = "fat": cross-crate inlining, removes trampolines through Bevy/wgpu.
|
|
# - codegen-units = 1: best optimization, at the cost of slower compiles.
|
|
# - panic = "abort": smaller binary, no unwind tables in the hot path.
|
|
# - strip: drop debug symbols from the shipped binary.
|
|
# `wasm-release` inherits release, so web picks these up too (then overrides
|
|
# opt-level to "z" for binary size).
|
|
[profile.release]
|
|
lto = "fat"
|
|
codegen-units = 1
|
|
panic = "abort"
|
|
strip = "symbols"
|
|
|
|
# Smaller wasm binary in release web builds (per Bevy examples README).
|
|
[profile.wasm-release]
|
|
inherits = "release"
|
|
opt-level = "z"
|
|
lto = "fat"
|
|
codegen-units = 1
|