simd-lite / simd-json

Rust port of simdjson
Apache License 2.0
1.14k stars 86 forks source link

Add documentation to explain how to use this library? #375

Open nk9 opened 4 months ago

nk9 commented 4 months ago

I am exploring adopting simd-json for parsing GeoJSON files in the geojson library. However, I'm having trouble understanding how this library is meant to be used. I thought it would be a drop-in replacement for serde (given that it falls back to serde for parsing when SIMD instructions aren't available). But when I just replace use serde::{etc} with use simd_json::{etc}, it turns out that simd_json doesn't export Deserialize, Serialize or Serializer. So clearly there's more to it.

The examples directory has just a single file in it, which is actually a benchmarking exercise. It's not clear from that code how to convert a serde_json implementation to one using simd-json.

The one glimmer of explanation I have found is in the Serde Compatible API section of the docs, but it has a warning saying that it's untested!

So I'm hoping I can get a pointer to some documentation or example code for how to acutally use this library to speed up an existing serde_json implemtation. Thanks in advance.

Licenser commented 4 months ago

Hi,

that's a bit misleading wording in the hint from docs.rs, it doesn't mean it's an untreated feature but that we do not run that example during normal unit tests you can use the serde interface it's well tested and stable.

It's also worth looking at https://github.com/simd-lite/simd-json-derive ; it only supports a subset from serde derives features but directly integrates with simd-json and is often significantly faster