Re:Making Rust binaries smaller by default
by lifthrasiir on Wednesday January 24, 2024 @06:33AM
(#39116105)
You are looking at the aftermath. Also, you could have manually put `strip = "debuginfo"` to avoid the 4 MB binary even before that; the issue is about the default when no `strip` option was given.
[ Parent
| on HN ]
Re:Making Rust binaries smaller by default
by josephg on Wednesday January 24, 2024 @06:43AM
(#39116166)
No, this is using stable rust 1.75. The binary is not stripped at all, and its still 400kb, not 4mb.
Re:Making Rust binaries smaller by default
by pdimitar on Wednesday January 24, 2024 @09:09AM
(#39117504)
Actually my issue is with including the stdlib in its entirety, sorry for not clarifying.
Indeed we could always strip the binaries and I've done so on every Rust project I worked on.
Re:Making Rust binaries smaller by default
by lights0123 on Wednesday January 24, 2024 @10:17AM
(#39118323)
You are aware that the stdlib is linked with --as-needed which tells the linker to not include unused code, right? The entire stdlib is not included in Rust binaries unless you use the entire stdlib. However, as this article shows, that does not apply to debug info.
Re:Making Rust binaries smaller by default
by pdimitar on Wednesday January 24, 2024 @10:20AM
(#39118358)
Actually I was not aware, thanks for clarifying!
Hrm, I read the comments of another user who contributes to Rust and it seems there is various formatting / panic / abort / symbol and location translation code that contributes to the size and currently there is not much that can be done about it.
Oh well.