1min.

1MIN · RUST

Rust’s derived Debug can quietly increase binary size

Rust’s built-in derive implementations often include an inline hint. For deeply nested Debug formatting repeated across logging sites, that can increase generated code: this investigation reports roughly 160 KB saved in uv by preventing one implementation from being inlined. The hint does not force inlining, and derive’s current behavior is not a language guarantee. Measure before applying the same trade-off elsewhere.

yossarian.net · Oct 3, 2026

Why it matters

A concrete explanation for unexpected binary growth in otherwise ordinary Rust code.

More context

The author uses a custom derive macro to attach inline(never) to the relevant implementation. Inspect generated code and compare binary size and runtime cost before adopting that technique.

Keep in mind

This is a targeted size optimization, not evidence that derived traits should generally avoid inlining.

Original read

More engineering ideas, one minute at a time.

Explore more stories