Repository navigation
Investigation - decreasing (statically linked) Wasm binary size #5218
QuantumSegfault
started this conversation in
General
Replies: 2 comments 4 replies
|
One thing I found awhile back is that ModuleInfo keeps around references to all classes defined within said module. Keeping classes around requires keeping their vtbl around, which requires keeping the otherwise unused code around. Disabling population of the ModuleInfo class list shaves 50 KiB off the example (down to ~300 KiB). Interesting to note is this note in https://dlang.org/spec/abi.html#ModuleInfo:
Removing the class list does break Could we introduce a way to opt out? |
3 replies
|
Using LTO-druntime might pay off as well ( Also see #4258, which shows that the (default non- |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
As it stands right now, if everything is built
-Oz(including wasi-libc), and--strip-debugis enabled on the linker (wasi-libc comes with debug symbols by default), a simple, no DRuntime, hello world program can fit in 4 KiB of Wasm.Without
extern(C)to exclude the DRuntime, a nearly identical program, with the same compiler command, takes up 350 KiB (edit: after #5127 gets merged)!Wasm is a platform that tends to value small code-size. Let's see if there's anything we can do to bring it down to a more reasonable figure.
All reactions