Get the latest tech news
Honey, I shrunk {fmt}: bringing binary size to 14k and ditching the C++ runtime
The {fmt} formatting library is known for its small binary footprint, often producing code that is several times smaller per function call compared to alternatives like IOStreams, Boost Format, or, somewhat ironically, tinyformat. This is mainly achieved through careful application of type erasure on various levels, which effectively minimizes template bloat.
This approach confines template usage to a minimal top-level layer, leading to both a smaller binary size and faster build times. Most notably, {fmt} now uses the exceptional Dragonbox algorithm for floating-point formatting, kindly contributed by its author, Junekey Jeon. We’ll apply the same methodology as in previous work, examining the executable size of a program that uses {fmt}, as this is most relevant to end users.
Or read this on Hacker News