It is not making the parser itself hundreds of times faster. On a cache hit, libfyaml mmaps the generic arena and directly uses that instead of parsing the file. Due to the design of the generic subsystem it even avoids relocation and in 64bit systems with ASLR.
Benchmark run using the python binding on AllPrintings.json sized 427.5 MB.
- cache off: 16.98 s, +13.4 GB RSS - cold cache: 22.45 s, +13.4 GB RSS - hot cache: 35.9 ms, +1.0 MB RSS
That is about 473x faster on the hot-cache path versus a normal parse, with a much smaller memory delta. Also note how the RSS is essentially zero; the generic data in the arena are not even faulted in.
This is intended for startup/config/data-loading workloads where the same large YAML or JSON file is read repeatedly.
Benchmark commit: https://github.com/pantoniou/libfyaml/commit/f150432b36e409a...