dtolnay / watt

Runtime for executing procedural macros as WebAssembly
Apache License 2.0
1.25k stars 29 forks source link

Debug info is compiled in #6

Open est31 opened 4 years ago

est31 commented 4 years ago

More than half of the (uncompressed) .wasm file of wa-serde-derive is made up of the debug info section.

est31 commented 4 years ago
$ cp serde_derive.wasm serde_derive_nodebug.wasm
$ wasm-strip serde_derive_nodebug.wasm
$ du -h *
1,1M    serde_derive_nodebug.wasm
2,8M    serde_derive.wasm
$ gzip serde_derive*
$ du -h *
232K    serde_derive_nodebug.wasm.gz
688K    serde_derive.wasm.gz

So it turns out, against my expectations, that the badly compressing part is actually the debug info while the code itself compresses pretty well. So removing debuginfo would greatly reduce the download size of the wa-serde-derive crate.

est31 commented 4 years ago

See https://github.com/serde-rs/serde/pull/1650 where I do some further tricks to get the compressed size down even further.