A hacker known as T0st found a bug in Grand Theft Auto Online that lay unfixed for 7 years. By fixing the bug, T0st was able to cut GTA Online loading times on their machine from 6 minutes to 2. T0st’s post was made on February 28. On March 16 Rockstar, the developer of GTA, released an update fixing the bugs and thanked T0st for their help.
According to an anonymous Reddit poll with 271 votes, the loading time for the online mode of GTA Online broke down as follows:
Clearly, T0st was not alone in suffering from long load times. However, they noticed that the long load times were only for the “online” mode of the game, not the “story” mode. Over the 7 years of GTA Online’s existence, some strange explanations and fixes had spread across the internet. But before T0st decided to tackle the problem, the most modders could do was shave off 10-30 seconds of the load time.
T0st began their investigation using the humble Windows Task Manager, and found that the online mode of GTA Online maxed out a single CPU core for 4 minutes. During those 4 minutes, there was hardly any change in disk, network, GPU or memory usage. Then T0st probed further using the Luke Stackwalker profiling tool, the x64dbg debugger and a “friend’s completely legitimate copy of the industry-standard disassembler”.
T0st eventually found that GTA Online was parsing a 10MB JSON file describing 63000 items and upgrades that can be bought using in-game currency. This would not normally take so long, but every time GTA Online would parse 1 item, it would calculate the length of the entire file. The items were also stored in an array, meaning that checking if an item already existed required reading all pre-existing items every time.
T0st wrote fixes for these bugs, because “no one is going to take me seriously unless I test this so I can write a clickbait title for the post.” The slow parsing was fixed by caching the length of the item file, and the array was replaced with a hash map. T0st then injected the fixes into their copy of GTA Online using MinHook. They were able to decrease the load time of online mode from 6 minutes to 1 minute 50 seconds.