Live data from Hacker News

Building a high performance JSON parser

dave.cheney.net

1–10 of 193 posts

Re: Building a high performance JSON parser

#3
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.

Re: Building a high performance JSON parser

#7
I'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

#8
post #5

[flagged]

Exactly, it's not too hard to implement in C. The one I made never copied data, instead saved the pointer/length to the data. The user only had to Memory Map the file (or equivalent), pass that data into the parse. Only memory allocation was for the Jason nodes.

This way they only paid the parsing tax (decoding doubles, etc..) if the user used that data.

You hit the nail on the head

Re: Building a high performance JSON parser

#9

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 .

If your JSON always looks the same you can also do better than general JSON parsers.
Post reply on HN