The driving, crime, and general mayhem game Grand Theft Auto V is something of a phenomenon that has lasted for the last seven or more years. Whether following the in-game missions, driving around like a hooligan for fun or performing crazy stunts, the depth of detail in its landscapes and the continual improvements to gameplay that have arrived over the years have assured it a massive following across multiple platforms. The game is not without its problems though, one of which is an unreasonably long loading time for its online version. This annoyed [T0st] to the extent that it was worth the effort of looking under the hood to find out where the problem lay.
It was evident that for PC users the effect varied depending on the hardware present. Furthermore AMD processors seemed worse-hit than Intel ones, and indeed they found an entire core maxed out by a couple of processes during the wait. Some diagnostics and disassembly led the trail to some string processing code which was identified as a JSON parser. This was not simply parsing the JSON but also performing a check for token uniqueness in an extremely inefficient manner, causing the whole process to be extremely slow. Sone nifty patching in a DLL containing a much more efficient function with a cache for unique values saved the day, and delivered an impressive 70% speed-up. It’s to be hoped that the game’s developers will take note, and a future GTA V update will deliver a fix.
Driving a car from a third-person viewpoint in a game like GTA V is a hoot. In real life though, not so much.
Thanks [Thanatos Erberus] for the tip.