A hacker going by the handle T0st says he has figured out a core issue that caused longer-than-necessary load times in Grand Theft Auto Online for years. The hacker has released a proof of concept DLL fix that shortens those lengthy startup times by roughly 70 percent.
Grand Theft Auto Online‘s PC load times have been a persistent issue for seven years now, remaining slow despite general improvements to hardware and the game’s status as a continuing lucrative revenue stream for publisher Take Two. An anonymous Reddit poll last year found that roughly half of players were waiting three to six minutes for the game to load up, and about 35 percent of players waiting even longer to start every session.
That’s not a scientific survey or anything, but even accounting for self-selection and reporting issues, those load times are very long, especially for such an old game. The problem is even harder to understand when the single-player Grand Theft Auto V tends to load many times faster.
Saving time with disassembly
To get to the bottom of the problem, T0st writes that they started by profiling their own CPU to try to figure out why the game was maxing out a single CPU thread for over four minutes during loading. After using a tool to dump the process stack and disassembling the GTA code as it was running in memory, T0st noticed a set of (somewhat obfuscated) functions that seemed to be parsing a 10MB JSON file with over 63,000 total entries.
The JSON file in question appeared to be the “net shop catalog” that describes every single item GTA Online players can purchase with in-game currency. Parsing a 10MB file shouldn’t be too much of a problem for a modern computer, but a few obscure problems in the specific implementation seem to lead to massive slowdowns.
For one, the specific function used to parse the JSON string (seemingly sscanf, in this case) was apparently running a time-intensive strlen checking function repeatedly after the read for every single piece of data. Simply caching that string length value to speed up those checks resulted in an over 50 percent reduction in load times on its own, T0st writes.
After parsing all this JSON data, GTA Online seems to load it into an array in an extremely inefficient way, checking the entire array for duplicates from scratch as it grows. Replacing that process with a hash table that can quickly check for duplicates led to a roughly 25 percent load time reduction on its own, T0st writes.
With these two fixes combined, T0st says GTA Online‘s load time went down from six minutes to just under two minutes on the test machine. Those interested in replicating the results can build a similar DLL from T0st’s source code. Players should only do so at their own risk, though, since this kind of modification could easily (and erroneously) set off the game’s anti-cheat checks.
Meanwhile, T0st writes that implementing this fix for all players on Rockstar’s side “shouldn’t take more than a day for a single dev to solve.” Here’s hoping the renewed attention this issue is getting will get Rockstar to do so sooner than later.
Let’s block ads! (Why?)