oysterpack / oysterpack-smart-near

OysterPack SMART
MIT License
2 stars 0 forks source link

Debug symbols are not getting stripped out of release wasm file - greatly inflating the size #1

Closed oysterpack closed 3 years ago

oysterpack commented 3 years ago

Even though I have the following release options set:

[profile.release]
codegen-units = 1
opt-level = "z"
lto = true
debug = 0
panic = "abort"
overflow-checks = true

[profile.release.package."*"]
codegen-units = 1
opt-level = "z"
debug = 0
overflow-checks = true

debug symbols were still being included, which can be seen via the twiggy tool. The wasm fil size was over 1.4 MB.

The short term work around was to use a rust nightly feature to strip out symbols which shrank the file size down to 92.8 KB

NOTES

oysterpack commented 3 years ago

Temporary solution to make it work with rust stable is to use the following rustc flags within /near/.cargo/config.toml :

[build]
rustflags = ["-C", "link-args=-s"]