Stream: ideas

Topic: stripping debug symbols


view this post on Zulip Richard Feldman (Apr 16 2022 at 18:22):

apparently Inkwell can strip debug symbols.

It seems reasonable to do this by default for --optimize builds, since we're optimizing and a smaller executable will run faster (all else being equal).

We could also add an optional --debug-symbols flag to keep them in.

Thoughts?

view this post on Zulip Ayaz Hafiz (Apr 16 2022 at 18:23):

agreed people are likely to strip the symbols otherwise anyway

view this post on Zulip Brendan Hansknecht (Apr 16 2022 at 22:33):

Do we even emit much? I feel like our default debug info is super lacking

view this post on Zulip Brendan Hansknecht (Apr 16 2022 at 22:35):

Not saying we won't save a few bytes

view this post on Zulip Richard Feldman (Apr 17 2022 at 01:22):

it's a surprisingly big difference for Rust hosts!

the 3 demos I'm looking at for Tuesday, without symbols and with symbols:

view this post on Zulip Brendan Hansknecht (Apr 17 2022 at 02:29):

That is probably host debug info? Not roc?

view this post on Zulip Brendan Hansknecht (Apr 17 2022 at 02:30):

So inkwell doesn't affect them?

view this post on Zulip Richard Feldman (Apr 17 2022 at 05:57):

fair point!

view this post on Zulip Richard Feldman (Apr 17 2022 at 06:01):

Hello World with different hosts:

view this post on Zulip Richard Feldman (Apr 17 2022 at 06:09):

actually all of this is probably dominated by the fact that I'm on mac, where ld doesn't support --gc-sections :stuck_out_tongue:

view this post on Zulip Richard Feldman (Apr 17 2022 at 06:10):

(although it does have the theoretically equivalent -dead_strip, except that I just found out it can't be used with the -r flag we give to ld)

view this post on Zulip Richard Feldman (Apr 17 2022 at 06:12):

so I guess in a future where we have a surgical linker, we can tell hosts to --gc-sections when making the executable, which theoretically should be fine as long as they have the right things marked as exposed and therefore ineligible for collection...or alternatively we can potentially do it ourselves in the surgical linker

view this post on Zulip Brendan Hansknecht (Apr 17 2022 at 07:54):

For sure. Though doing GC on the host would probably be a hassle in the surgical linker. Doing GC on the app should be just fine though.

view this post on Zulip Brian Carroll (Apr 17 2022 at 08:03):

Yep, can confirm it's hassle! But I actually did it in the wasm backend, because without it the tests were just unbearably slow. Had to do it for my own sanity. Wasmer is orders of magnitude slower than v8.
So I keep track of which builtins and host functions the app actually uses, then trace through their call graphs in a "mark" phase, then do a "sweep" phase to remove them.

view this post on Zulip Brian Carroll (Apr 17 2022 at 08:05):

Though I don't strip debug symbols. I figure if you are using a dev backend then you probably want them.

view this post on Zulip Brian Carroll (Apr 17 2022 at 08:06):

Stack traces and stuff are terrible without them


Last updated: Jun 16 2026 at 16:19 UTC