Hey Rockstar, GTA Online Has A Bad CPU Bottleneck That Slows Loading But There's A Fix
is Rockstar's incredibly popular cash cow that has been keeping gamers busy since 2013. Although the game should be relatively mature at this stage in its life, it still has plenty of flaws, such as horrendous loading times. These loading time issues have annoyed countless players, and now one player has tracked down the root issue to improve performance.
fan T0ST recently picked up GTA Online again to finish some new heists that have come out since he last played, but he was "shocked (/s) to discover that it still loads just as slow as the day it was released 7 years ago." With some grit, determination, and perhaps even some spite, T0ST decided it was "time to get to the bottom of this."
In the process of digging into GTA Online, T0ST had to do due diligence and research to make sure no one else figured out the problem. Once it was established that no one had, he ran some benchmarks on his PC with an aging FX-8350 CPU, NVIDIA GeForce GTX 1070 GPU, 16GB of DDR3, and a "cheap-o" Kingston SSD. Though these parts may be old, they should be plenty to get GTA Online off the ground in decent time, but that is not what happened. According to the data in the blog post
, T0ST got into the story mode in approximately one minute and ten seconds, whereas it took nearly six minutes to get into online mode. After some polling, it appears that many other users are having the same issue . What could be happening here?
Using the task manager, T0ST found that his CPU was being eaten for around four minutes during GTA Online's load process. Perhaps it was just a bottleneck happening on his CPU alone, but that would not make much sense. To track down the issue, T0ST went to dump the running processes' stack, showing where the offending process is happening in RAM. This information, acquired through Luke Stackwalker, gave T0ST a place to look for whatever was causing issues.
After falling down the rabbit hole of trying to track down where the memory pointed, it all started to come together through assembly code reading and obfuscation. Evidently, when loading into GTA Online, a whopping 10MB worth of JSON is being parsed. It seems that it is data for something called "net shop catalog," which is likely just all the things purchasable in GTA Online using in-game currency.
Why this parsing takes so long is due to a function used called sscanf, which, in this instance, can be loosely equated to reading Romeo and Juliet by reading one word, then rereading the play, and then jumping back to the next word in the play. Furthermore, there is another bad programming issue just beside sscanf, which goes through the entire list of JSON entries in an array, one by one, and checks to see if there are duplicates by comparing a unique ID assigned to each item called a hash. Ultimately, it is a lot of extra and unnecessary work that slows down everything.
To solve this issue, T0ST decided to write a .dll (Dynamic Linked Library) and inject it into GTA so that sscanf is effectively streamlined. Also, rather than running duplication checks, they can just be skipped as items inserted into the storage array will always be unique, as was set up during the parsing effort. Once T0ST injected the DLL into GTA with both issues fixed, he saw his load times go from around six minutes down to a solid approximate two minutes.
As T0ST explains, this "won't solve everyone's load times - there might be other bottlenecks on different systems, but it's such a gaping hole that I have no idea how R* has missed it all these years." Ultimately, Rockstar
needs to dig into this issue to save all GTA Online players headaches during loading. If you want to see what T0ST did exactly, you can check out his GitHub here
and see what is going on. In any case, perhaps we will soon get an official statement from the development company, so keep an eye on HotHardware