-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance between 'Values API' and 'Serde Compatible API'. #370
Comments
Hi, sorry for the late reply I'm just finishing some vacationing and was mostly away from the computer. That makes a good bit of sense, the serde mapping code is quite complex and by that expensive to execute - irespective of the decoder (serde-json, simd-json, serde-yaml ... etc). By contrast the value API is kept as simple as possible so the overhead is just lower. In some cases the extra cost of allowing abritary values is less then the extra cost of serde. There is a 3rd api, the simd-json-derive api that allows to decide directly into structs w/o the value API, that will be faster still but is less flexible. Last but not least, I want to point out that this isn't serde being bad, or not well written. serde is made to allow nearly arbritary format translations and is extremely powerful that way - it does this extremely well, but such power usually comes at a cost. the simd-json-derive macros are extremly specific so can take a lot of shortcuts serde simply can't that's where the performance benefit can be gained. |
I implemented the There's also a dependency to The branch is here https://github.com/PSeitz/serde_json_borrow/tree/simd_json_value_builder.
|
This is really awesome @PSeitz ! |
I noticed that simd-json offers two main entry points for usage: 'Values API' and 'Serde Compatible API'.
I ran benches/parse.rs to test the performance. I added code below to test simd_json::serde::from_slice:
Here's the result:
The 'Values API' is mostly better than serde except canada(146.48 vs 152.69). However, the performance of 'Serde Compatible API' seems not that good, the result of canada cannot be acceptable(114.10 vs 152.69). I'd like to use simdjson to increase the performance, so it's better to use 'Values API'? And if my data is similar to canada, it's better not to use simdjson?
The text was updated successfully, but these errors were encountered: