When you use the C stdlib you’re a bit stuck. When you write your own library you can hopefully avoid having functions with subtle performance and make sure things are documented well (but then you also don’t think they should be writing their own library).
Clear gta 5 pc hacking update#
I’m still not convinced that it’s realistically possible to have people very carefully understand the performance characteristics of every function they use.Įvery programmer I know thinks about performance of functions either by thinking about what the function is doing and guessing linear/constant, or by knowing what the data structure is and guessing (eg if you know you’re doing some insert operation on a binary tree, guess that it’s logarithmic), or by knowing that the performance is subtle (eg “you would guess that this is log but it needs to update some data on every node so it’s linear”). The problem is that it also calls strlen. JSON is deceptively simple, but there's still enough subtlety to screw things up, qed.īut sscanf does do what they want it to do by parsing numbers. Or, you know, don't implement your own parser. But using a more appropriate and tighter function (atoi?) would have avoided the issue as well. There might be an issue that scanf doesn't document it's performance well. I don't know, at face value it seems reasonable to expect programmers to carefully check whether the library function they use does what they want it to do? How would you otherwise ever be sure what your program does? I think that “don’t use library functions that don’t do what you expect” is impossible advice. > The subtlety is that sscanf doesn’t do what you expect. I assume that's where the slowdown comes from here - scanf needs to implement a ton of features, some of which need the input length, and the implementor expected it to be run on short strings. I think part of the problem is that scanf has a very broad API and many features via its format string argument. ), which you read as “parse the digits at the start of the string into a number,” which is obviously linear.
Clear gta 5 pc hacking code#
it’s very easy to write accidentally quadratic code and the canonical example is this sort of triangular computation where you do some linear amount of work processing all the finished or remaining items on each item you process.Īs I read the article, my guess was that it was some terrible synchronisation bug (eg download a bit of data -> hand off to two sub tasks in parallel -> each tries to take out the same lock on something (eg some shared data or worse, a hash bucket but your hash function is really bad so collisions are frequent) -> one process takes a while doing something, the other doesn’t take long but more data can’t be downloaded until it’s done -> the slow process consistently wins the race on some machines -> downloads get blocked and only 1 cpu is being used) actually measure performance and try to improve it The linear search was also an example of bad quadratic code that works fine for small inputs. With smaller test data this may have been harder to catch.
I think most people’s mental model of sscanf is that it would be linear in the number of bytes it scans, not that it would be linear in the length of the input. I don’t think the lesson here is “be careful when parsing json” so much as it’s “stop writing quadratic code.” The json quadratic algorithm was subtle. But if it was a CPU bottleneck then who works there that wouldn't just be irked to try to nail it? I mean it seems like a natural thing to try to understand what's going on inside when time is much higher than expected even in the case where performance is not crucial.
Clear gta 5 pc hacking full#
But how could R* not do this? GTAV is so full of great engineering. Stunning work just having binary at hand. If this is true that's the biggest WTF I saw in the last few years and we've just finished 2020. Parsing JSON?! I thought it was some network game logic finding session magic.
Then there are man-years wasted (in a way different than desired). I'm certain that many people left this game because of the waiting time. Holy cow, I'm a very casual gamer, I was excited about the game but when it came out I decided I don't want to wait that long and I'll wait until they sort it out.