fmt Faster Than cout
{fmt} is now ~35% faster than printf on tinyformat speed test (previously it was "only" ~10% faster) and almost 4x faster than cout. 🚀 How can cout be so slow? Can it be made faster with the same optimisations like fmt has now? It is possible to apply some of the optimisations but not all. iostreams are slow by design because they are stateful and always use the locale. I'm still surprised that they are so much slower though. On Linux the difference is smaller IIRC.
A Twitter thread discusses the {fmt} C++ formatting library outperforming printf and cout in a benchmark. Someone asks why cout is so slow, and the response explains that iostreams are stateful and locale-aware by design, making them slower; the joke is aimed at programmers reacting to surprising performance differences between C++ output methods. EN: A Twitter thread discusses the {fmt} C++ formatting library outperforming printf and cout in a benchmark. Someone asks why cout is so slow, and the response explains that iostreams are stateful and locale-aware by design, making them slower; the joke is aimed at programmers reacting to surprising performance differences between C++ output methods.
Twitter screenshot / скриншот Twittertweet / твитreply thread / ветка ответовprogramming code / программный кодbenchmark text / текст бенчмаркаrocket emoji / эмодзи ракетыprofile photo / фотография профиляdark mode interface / интерфейс в тёмной темеC++ formatting library / библиотека форматирования C++computer text / компьютерный текст
- @ithueti / 1696 2019-11-22
- Type
- image
- Size
- 423×800 · 73.6 KiB
- Mood
- sarcastic, technical
- Language
- en
- Added