GTA logo editorial design
← All posts

The Six-Minute Loading Screen That Was Secretly an O(n²) Bug

For years, GTA Online was infamous for brutal loading times — often five to six minutes just to get into a session. In 2021, a modder going by t0st got curious enough to actually profile it, and found the cause wasn't networking or disk I/O. It was a single-threaded JSON parser doing something almost comically inefficient.

GTA Online stores each player's stats, inventory, and purchase history as a large JSON blob. Every time that blob loaded, the game checked each new key against every key already parsed — to detect duplicates — before inserting it. That check scaled quadratically: double the JSON size, and the parsing time roughly quadruples. Years of added content, items, and microtransaction records had bloated that blob, so a system that was probably fine at launch had become the dominant cost of joining a session. t0st also found the game was redundantly parsing a 10MB list of in-game item prices on every single load, for no functional reason.

The fix itself wasn't exotic — replace the O(n²) duplicate check with a hash-set lookup, cache the price list instead of reparsing it — and it cut load times by up to 70%, achieved entirely client-side by someone with no access to Rockstar's source. Rockstar eventually shipped an official patch addressing the same bottlenecks.

What makes this worth knowing as a backend or full-stack developer isn't the GTA trivia — it's how invisible this class of bug is from the inside. Nobody at Rockstar set out to write an O(n²) parser; it's almost certainly code that was correct and fast when the data was small, and nobody revisited the algorithm as the data grew by orders of magnitude over years of live updates. That's a very normal way for performance bugs to form: not a bad decision at the time, but a reasonable one that stopped being reasonable as scale changed underneath it, with no single commit that "caused" it.

The practical takeaway scales down easily: when something that used to feel instant has quietly gotten slow, profile it before assuming it's infrastructure. A JSON parse, a config reload, a "just loop through and check" validation step — these are exactly the places where a small, forgotten loop ends up owning your latency budget as your own data grows.

Sources: Hackers Succeeded in Reducing Load Time in Grand Theft Auto: Online by 70% · Hey Rockstar, GTA Online Has A Bad CPU Bottleneck That Slows Loading But There's A Fix

Keep reading