Honey, I shrunk {fmt}: bringing binary size to 14k and ditching the C++ runtime

The {fmt} formatting library is praised for its minuscule binary size compared to other alternatives like IOStreams and printf, achieved through strategic use of type erasure. It offers full runtime type safety, catchment of format errors at compile time, and efficient call handling, especially for positional arguments. Recent optimizations, including the use of the Dragonbox algorithm for floating-point formatting, have maintained the library’s size below 100kB. Unique approaches, such as disabling locale support and removing unnecessary types through the extension API, can further reduce the binary size, making it appealing for memory-constrained and retro computing applications. As further optimizations are explored, its dependency on the C++ standard library remains a challenge to fully eliminate.

https://vitaut.net/posts/2024/binary-size/

To top