[conspire] Guy reduces GTA load time by 70%…without the source code

Deirdre Saoirse Moen deirdre at deirdre.net
Tue Mar 16 12:55:39 PDT 2021


As someone pointed out on Twitter here: https://twitter.com/rauchg/status/1371598287698980869

> Imagine adding to your LinkedIn…
> 
> "2021-2021 📈 Made GTA Online boot up 70% faster for millions of players *while not* working for Rockstar Games, without the source code” 😆

I’m really surprised this wasn’t addressed earlier, as onboarding times (including launch times) are often looked at for ways to improve performance.

https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/

But, one of the problems was (wait for it) JSON parsing. JSON (including YAML as all JSON is YAML), and its semi-predecessor XML, is that they’re verbose file formats.

In the old days, you might have a structure like this saved in a file:

    struct pet {
        longint id;
        longint ownerid;
        char  *name;
    };

You *could* (and often did) just read the first two longints directly into the struct. You don’t need to parse them. Then you read the glob of the string into memory and assigned the pointer to fido.name.

let’s say fido’s an instance of that struct, this time in the JSON form:

    {
    	"id": 1,
        "ownerid": 1,
        "name": "Prince Charles \"Fido\""
    }

So you have to scan through the string, looking for the beginning and ending quote, and be careful not to trip over the escaped quotes in the middle.

We have all the reading we had before, have to parse 3 tags (as well as the hierarchy) and then the value string, as well as converting the numbers from string to ints.

Why aren’t they using a more sensible file format? *waves fist* This is a document *internal to them*, so they can economize. JSON is best used where two parties are talking to each other, IMHO, e.g., an API for museum data.

Then to have a bad JSON parser on top of it is just maddening.

Deirdre




More information about the conspire mailing list