Does anyone have insights on the parsers’ performance for reading large attrsets from JSON vs Nix expressions?
For example if I need to serialize a large Nix expression ( all primitives ) am I shooting myself in the foot writing a Nix file vs JSON?
Aside from the PITA of writing a serializer in Nix ( not really that bad, but toJSON is just sitting here ); I was honestly doing it under the assumption that it was going to be faster than JSON → Nix.
I can benchmark but thought I’d poke my head in to see if anyone had already tested this.
For context Im reading/writing large lockfile type data with ~100,000 string and boolean attrs.
In my experience, JSON is faster than Nix. Most likely because the parser is simpler.
I wrote a little benchmark, and the difference at least for simple structures is rather small, (JSON is about 1.5x faster)
Thank you. Makes total sense. JSON parsing is dead simple while Nix has a much more complex parser and lexer, even if you aren’t “using” most of the features.