17 ms·
Oh yeah, that was down to a huge JSON file / slow JSON parser or something wasn't it? That was so bad.
by Cthulhu_ 2y ago
Oh yeah, that was down to a huge JSON file / slow JSON parser or something wasn't it? That was so bad.
- tpxl 2y agoThey wrote their own json parser which used strlen() all over the place, which is O(n), resulting in O(n^2) complexity for json parsing. The guy shimmed the function to return a cached response if it was called with the same string consecutively, which it was for parsing the JSON. The JSON contained the items in the real-money store btw.
- consteval 2y agoWhy would anyone ever write their own JSON parser? There're countless libs available that are hyper-optimized.