A crafty GTA Online player has found a way to drastically reduce the load times of the game after cutting them down by almost 70%. The lengthy load times were apparently caused by a process that repeatedly checked over every purchasable weapon in the game. The player who solved the problem also pleaded with Rockstar Games and said that the issue "shouldn't take more than a day for a single dev to solve," though Rockstar Games hasn't said anything about the situation yet to confirm if that's the case or not.
Credit for the reduction in load times goes to the GTA Online player who goes by "t0st" and shared their findings with the rest of the community in a post seen here. After first establishing that it took around six minutes to load into GTA Online, the player used Task Manager and other tools and set to work figuring out what was taking the game so long to load. They noticed their CPU usage going up without any apparent indicator of what was causing that spike.
After taking a look at the game's coding, the player found something called a "net shop catalog" which they assumed to be a list of all the possible items and upgrades players can purchase in GTA Online. Anyone who plays GTA Online can tell you that's a lot of items, and according to t0st, the 10MB list consisted of around 63,000 item entries.
Things get a bit harder to follow from there if you're not well-versed in the technological terms t0st uses, but thankfully, Digital Foundry was able to simplify the matter. As the game read the text file of the buyable items, it would count every character in the file every time a new item was read which means the process was repeated 63,000 times.
On top of that, a value assigned to each item was checked against the other values of other items over and over. That again happened 63,000 times, and these sorts of checks would take up more time as more items were loaded into the game. You don't have to be too knowledgeable about the terminology at this point to see how process like that would take up a lot of time.
The solution to the problem provided by t0st was to create a cache calculating the length of the list of items just one time with that value returned each time instead of checking everything 63,000 times. The result was a reduction in load times by 69.4%. The post concluded with suggestions for Rockstar games to fix the problem and how it could be done, so now the community will have to wait to see if the developer reponds.