Post #728581
2026-01-28 08:25 UTC
https://github.com/rust-lang/backtrace-rs/pull/729 I optimized the size of every Rust binary (that uses the standard library) by over 1kb :). It's not a lot but it's something! It was quite interesting to figure out how to do it, there were some easy size optimizations around more cleverly placing function boundaries to reuse code, and in the end I went all in with some unsafe to remove bounds checks :3.
Replies (1)
-
@noratrieb@hachyderm.io 2026-01-28 08:27
my favorite one was moving a variable declaration of a Vec down to where it was used instead of the start of the function, so that early returns before that didn't need to worry about dropping it