r/cpp • {fmt} • Jul 20 '26

Żmij 1.1 released with fixed notation support, up to 38% faster double-to-string conversion, SIMD-optimized float formatting, a smaller binary footprint and more

41 Upvotes

40 comments sorted by

View all comments

Show parent comment

4

u/usefulcat Jul 21 '26

Logging. Generally, the faster you can serialize, the more you can log without delaying some other import operation.

1

u/mapronV Jul 21 '26

I just looked at component in big project I maintain, for 200+ log lines single one logs float value. Maybe for something like 3d game it can be a thing, where floats occur more often. Still 200% sure that any memory allocation or disk write will be several magnitudes slower than one float formatting even with iostream...

7

u/jk-jeon Jul 21 '26

Still 200% sure that any memory allocation or disk write will be several magnitudes slower than one float formatting even with iostream...

Try to write billion double to a text file using fstream. You will see how much slower the writing speed is compared to the disk's theoretical performance. Such workload is very often CPU bound, not I/O bound. That's what I remember from a few years ago.

2

u/usefulcat Jul 21 '26

Sure, in your particular case, you might not see any benefit from this optimization. That doesn't mean that there don't exist other situations that would benefit.

2

u/mapronV Jul 21 '26

That's why I asked. What are they. What are those projects. I was curious, I wanted to learn, I wanted to be less ignorant. A lot of people in this thread were eager to tell and I am thankful.