namada icon indicating copy to clipboard operation
namada copied to clipboard

slimmer wasm build

Open tzemanovic opened this issue 4 years ago • 4 comments

It looks that some dependencies (even when unused) end-up bloating the built wasm size, so we should investigate if we can remove some unnecessary dependencies from them (specifically, anything from the transitive deps from the shared crate imported via vm_env and now vp_prelude/tx_prelude crates).

┆Issue is synchronized with this Asana task by Unito

tzemanovic avatar Dec 09 '21 15:12 tzemanovic

@murisi can you check this (low priority, if it's hard just close the issue) since you were looking into the WASM compilation?

cwgoes avatar Jan 12 '23 14:01 cwgoes

@cwgoes Sure! Will take a look at this...

murisi avatar Jan 22 '23 11:01 murisi

one thing that has a significant impact on the size of built wasm are allocations - see e.g. https://nickb.dev/blog/avoiding-allocations-in-rust-to-shrink-wasm-modules/

tzemanovic avatar Jun 19 '23 06:06 tzemanovic

I got some good results with disabling "std" and "clock" features in chrono which decreased most of the WASMs over 10 times, but I didn't get it fully done as there is a bunch of logic that depends on it that would need some modifications to get this to work. Most of it is in our time.rs module that we can feature guard

tzemanovic avatar Jun 20 '23 16:06 tzemanovic