minio / simdjson-go

Golang port of simdjson: parsing gigabytes of JSON per second
Apache License 2.0
1.8k stars 85 forks source link

examples: OpenRTB request parsing #75

Closed stokito closed 1 year ago

stokito commented 1 year ago

Here is an example extracted from a real highly loaded OpenRTB parser. It's a good sample how to work with inline structures and arrays.

I'm not sure that this is the most efficient way of use so please tell me if something can be optimized. For example reuse of the ParsedJson on the benchmark increases usage of memory. I don't know how this can be explained. Maybe you have a guess why.

klauspost commented 1 year ago

@stokito The iterators and stuff seems to be stack allocated, so they are cheap.

The only impactful improvement would be to avoid all the strings, since they will of course need allocs, but that would be a quality of life reduction.