The walkthrough is very nice, how to do this if you're going to do it. If you're going for pure performance in a production environment you might take a look at Daniel Lemire's work: https://github.com/simdjson/simdjson . Or the MinIO port of it to Go: https://github.com/minio/simdjson-go .
Building a high performance JSON parser
31–40 of 193 posts
Re: Building a high performance JSON parser
#32I remember reading a SO question which asks for a C library to parse JSON. A comment was like - C developers won't use a library for JSON, they will write one themselves. I don't know how "true" that comment is but I thought I should try to write a parser myself to get a feel :D So I wrote one, in Python - https://arunmani.in/articles/silly-json-parser/ It was a delightful experience though, writing and testing to br…
Link here, if interested to have a look: https://github.com/rgex/jsoncut
Re: Building a high performance JSON parser
#33nowadays I am more interested in a "forgiving" JSON/YAML parser, that would recover from LLM errors, is there such a thing?
Re: Building a high performance JSON parser
#34The walkthrough is very nice, how to do this if you're going to do it. If you're going for pure performance in a production environment you might take a look at Daniel Lemire's work: https://github.com/simdjson/simdjson . Or the MinIO port of it to Go: https://github.com/minio/simdjson-go .
The fastest json lib in Go is the one done by the company behind Tiktok.
Re: Building a high performance JSON parser
#35[flagged]
Even just "Json" is problematic here as wire protocol for absolute performance no matter what will be programming language.
Re: Building a high performance JSON parser
#36The most important thing, though, is the process: measure then optimize.
Re: Building a high performance JSON parser
#37The walkthrough is very nice, how to do this if you're going to do it. If you're going for pure performance in a production environment you might take a look at Daniel Lemire's work: https://github.com/simdjson/simdjson . Or the MinIO port of it to Go: https://github.com/minio/simdjson-go .
Re: Building a high performance JSON parser
#38I'm surprised there's no way to say 'I really mean it, inline this function' for the stuff that didn't inline because it was too big. The baseline whitespace count/search operation seems like it would be MUCH faster if you vectorized it with SIMD, but I can understand that being out of scope for the author.
Re: Building a high performance JSON parser
#39Earlier quoted context omitted.
If your JSON always looks the same you can also do better than general JSON parsers.
I wonder: can fast, special-case JSON parsers be dynamically autogenerated from JSON Schemas? Perhaps some macro-ridden Rust monstrosity that spits out specialised parsers at compile time, dynamically…
Re: Building a high performance JSON parser
#40I remember reading a SO question which asks for a C library to parse JSON. A comment was like - C developers won't use a library for JSON, they will write one themselves. I don't know how "true" that comment is but I thought I should try to write a parser myself to get a feel :D So I wrote one, in Python - https://arunmani.in/articles/silly-json-parser/ It was a delightful experience though, writing and testing to br…
> I don't know how "true" that comment is
Either way it's a good way to get a pair of quadratic loops in your program: https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times...