News for hackers. Stuff that matters.
Re:How I cut GTA Online loading times by 70% by nicoburns on Sunday February 28, 2021 @07:34PM (#26298511)
You mention quadratic behaviours and there's probably some truth to that, but it seems to me that it's partly a C++ problem. In any other langauge nobody would even consider hacking up JSON parsing using a string function. They'd use the stdlib functional if available or import a library, and this problem wouldn't exist.
Re:How I cut GTA Online loading times by 70% by nitwit005 on Sunday February 28, 2021 @07:53PM (#26298626)
A lot of other languages make use of the c standard library functions to parse floats (and to do various trigonometric functions), so they may be more similar than you imagine.
Re:How I cut GTA Online loading times by 70% by oblio on Monday March 01, 2021 @04:04PM (#26308398)
Not super relevant, though. The average standard library from another language is a lot more hardened than the function written by Joe Sixpack in C last night.
Re:How I cut GTA Online loading times by 70% by raverbashing on Monday March 01, 2021 @01:57AM (#26300323)
But C++ had at least a hash_set/hash_map since forever (or just set/map which are still better than this)

I'm sure there are libraries to parse json in C++ or at least they should have built something internally if it's critical, instead they have someone less experienced build it and not stress test it?

Re:How I cut GTA Online loading times by 70% by nicoburns on Monday March 01, 2021 @05:39AM (#26301441)
>I'm sure there are libraries to parse json in C++

There certainly are, but adding a library is much more difficult in C++ than pretty much any other language which seems to tempt people into hacky self-built parsing when they really ought to know better.

Re:How I cut GTA Online loading times by 70% by bleachisback on Tuesday March 02, 2021 @12:47AM (#26312256)
The first C++ JSON library that appears when you google it is a single header file.

https://github.com/nlohmann/json

I know because I used it years ago in school.

One of the fastest libraries (https://github.com/miloyip/nativejson-benchmark#parsing-time) is also header-only and compares its speed to strlen.

https://github.com/Tencent/rapidjson

Re:How I cut GTA Online loading times by 70% by secondcoming on Monday March 01, 2021 @03:54AM (#26300828)
Rapidjson