Posts: 3,667 +1,129
When devs fail, DIY: Gaming mods are a dime a dozen, especially for Grand Theft Auto Online. But occasionally, someone comes along with one that is so good and yet so basic that you wonder why the developer didn't do the same thing in a patch. One hacker has shown a fix for load times that is so simple you'll wonder why Rockstar didn't take care of it years ago.
Without a doubt, Grand Theft Auto Online's load times are atrocious. A non-scientific poll conducted on Reddit last summer revealed that most were waiting three to six minutes for the game to start and more than 35 percent of players had load times longer than six minutes. In the worst-case scenarios, wait times were over 15 minutes.
A hacker who goes by T0st looked into what might be causing his six-minute load times. After dumping the process stack, he discovered two bottlenecks that maxed out a single CPU thread. A poorly written routine was inefficiently parsing a 10MB JSON file containing over 63,000 items.
As it turns out, the JSON file housed items purchasable through in-game shops (not to be confused with microtransactions). The routine reads each entry in the file and then stores it in an array. With each pass, it rechecks the entire array for duplicates before inserting the new item. As can be imagined, this process gets longer and longer as the array grows.
To fix the problem, T0st created a DLL that eliminates the two bottlenecks. The first fix "caches" long string lengths.
"If it's called again within the string's range, [it will] return [the] cached value," T0st writes.
Since this fix eliminates repeat entries, the duplicate check is no longer necessary. So the second part of the DLL simply inserts the values into the array.
The results of these two patches are pretty remarkable. With only the duplication check fix installed, load time was modestly reduced from six minutes to 4.5 minutes. The JSON parser was much more effective, lowering the wait to two minutes, 50 seconds, and implementing both patches into the DLL improved load time by about 70 percent (or 1m 50s).
Results may vary depending on rig configuration, but the optimizations should improve loading speeds significantly for any setup.
T0st posted the proof of concept to GitHub if you're interested, though he warns that injecting it while online might get you suspended. His writeup on how he found and fixed the problem is a pretty good read, too. He hopes that Rockstar will get wind of his PoC and issue an official patch, which is not an unreasonable ask for the studio's seven-year-old cash cow.
"If this somehow reaches Rockstar: the problems shouldn't take more than a day for a single dev to solve," he writes. "Please do something about it."
Yes. Please do.