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/mapronV Jul 20 '26

If you transferring Gygabytes of text between you and thirdparty, something wrong happened before you started writing a protocol... If they are providing some valuable commercial info, it is in their interest make it efficient in first place, right?
In any work place, if there is a discussion about "parsing JSON" larger than 1 Mb I raise an eyebrow.
If it's "more than 100 Mb" then I will raise my hand and ask to discuss matter with architect of this system.
I mean exceptions happen... but this is not first time I ask for sharing experience on BIG [TEXT] data :)

p.s. I in no doubt that JSON exchange will increase, but someone still want to be vocal about "huge json" problem.

7

u/Dragdu Jul 20 '26

In any work place, if there is a discussion about "parsing JSON" larger than 1 Mb I raise an eyebrow. If it's "more than 100 Mb" then I will raise my hand and ask to discuss matter with architect of this system. I mean exceptions happen... but this is not first time I ask for sharing experience on BIG [TEXT] data :)

So for fun, I opened Kaggle datasets and filtered on those with JSON (https://www.kaggle.com/datasets?fileType=json). In top 10, there are multiple datasets with multiple hundred MBs of JSONs.

I now expect you to go discuss with them why they are using JSON ;-)

1

u/mapronV Jul 20 '26

Surely, if I have a chance to work for owner of that dataset, I will raise some limbs :D

13

u/not_a_novel_account cmake dev Jul 20 '26 edited Jul 20 '26

"parsing JSON" larger than 1 Mb I raise an eyebrow.

It's not a single 1Mb JSON message, it's millions of JSON messages each with one or two floats in them. The performance savings are aggregate and fleet-wide, not a single operation which is now 5% faster.

It's the same kind of performance savings that swiss tables or folly strings are designed for. Not "this application is now 2x", but "fleet wide, we're saving a statistically measurable amount of compute".

2

u/mapronV Jul 20 '26

So, if I understand correctly your idea: I should not think about a workflow requiring parsing millions of floats, but rather on idea of reducing computational cost for 0.01% where it is already optimized to bit and femtosecond? "we could not think of squeezing more from this lemon then this library allowed us to get 3 more buckets of juice"? smth like that?

9

u/not_a_novel_account cmake dev Jul 20 '26

Yes, large organizations often spend engineering time optimizing already-fast-but-we-could-get-even-more operations that are common throughout their entire fleet. The goal is to leave no room for improvement. Hash maps, string operations, stuff like that.

At FAANG scale, these savings are economically meaningful.

2

u/mapronV Jul 20 '26

Thanks, I did not want to make a flame to happen; your response was something to think about.

-3

u/SkoomaDentist Antimodern C++, Embedded, Audio Jul 20 '26

At FAANG scale, these savings are economically meaningful.

So why do people keep posting and hyping about such libraries to forums where 99% of the people don't do anything at remotely that scale?

This isn't the first time I see people act like shaving a nanosecond from converting between floats and text is something that helps regular devs.

6

u/not_a_novel_account cmake dev Jul 20 '26

Stuff like this eventually makes its way into everyone's code. Ryu, which is this problem in the opposite direction, was notable enough to generate entire conference talks, and is now universally applied via the stdlibs.

Moreover it's a cool programming problem being solved in C++, so this is the natural forum for discussing it.

1

u/Dragdu Jul 21 '26

I too like my dependencies to be slower than they can be.