| Last updated
You know it, I know it - Grand Theft Auto V's loading times are long. Like, you could brew yourself a mug of tea in the amount of time it takes to load that game. Hopping on an aeroplane, heading on over to a farm to pluck the leaves yourself, washing and draining the leaves, then roasting the leaves to your taste, crushing them and then steeping them in hot water, and pouring the liquid through a strainer. And, you'd have some time to enjoy the beverage before the game begins. Those days are over now, so cancel your flights, because this player has rummaged around in the code to decrease loading times by nearly 70%.
At first blush, I assumed dark magic was at work here. But, GitHub user tostercx has not only done away with the bane of all GTA players' lives, they've also explained why players were waiting that long to get into the game and how they rectified what was going on. "Having picked up [Grand Theft Auto Online] again to finish some of the newer heists I was shocked (/s) to discover that it still loads just as slow as the day it was released 7 years ago," said tostercx (the (/s) means you should read the statement in a sarcastic tone, just so you know). According to a player poll referenced in their explanation, about 80% of players are waiting three to six minutes to get into the game. 11% of players will be twiddling their thumbs for ten minutes or more. Yikes.
Picking apart the code, tostercx discovered that there is a section of code that looks like it's been dragged through a hedge backwards, accompanied by a 10MB JSON file containing 63,000 item entries. The impact of this is that every time an item is found by the code, the check determines whether it's meant to be there or not, and if it passes, it puts it in an array. It does this check every. Single. Time. "The hash-array-list-thing is empty before loading the JSON. And all of the items in the JSON are unique! They don't even need to check if it's in the list or not! They even have a function to directly insert the items!" exclaimed tostercx, and they estimate that this strange coding choice causes approximately 1,984,531,500 checks while the game is loading.
They also found that the game is only using one core on their CPU, and in ironing out the wrinkles in the seven year old code, tostercx cut the loading time of Grand Theft Auto Online to an agreeable one minute and 50 seconds. That's a 69.4% improvement on the original time. If this is music to your ears, then the new code is available here (but tostercx advises that it's really more of a proof of concept than a proper fix).
Chosen for YouChosen for You
Most Read StoriesMost Read