Investigate using simd-json for performance improvements
rtyler opened this issue · 2 comments
rtyler commented
In production 🌠is typically CPU bound on JSON parsing, JSON serialization, and Handlebars template rendering.
simd-json might be a good route to explore for enabling for platforms that support SIMD.
rtyler commented
At first glance it looks like simd-json is not API compatible with serde, since its from_str
and from_slice
methods will actually consume the buffer 🤦
Compiling hotdog v0.3.3 (/home/tyler/source/github/reiseburo/hotdog)
error[E0308]: mismatched types
--> src/json.rs:15:41
|
15 | simd_json::serde::from_str::<S>(buffer)
| ^^^^^^ types differ in mutability
|
= note: expected mutable reference `&mut str`
found reference `&'a str`
error[E0308]: mismatched types
--> src/json.rs:15:9
|
12 | pub fn from_str<'a, S: serde::Deserialize<'a>>(buffer: &'a str) -> Result<S, serde_json::error::Error> {
| ----------------------------------- expected `std::result::Result<S, serde_json::error::Error>` because of return type
...
15 | simd_json::serde::from_str::<S>(buffer)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `serde_json::error::Error`, found struct `simd_json::Error`
|
= note: expected enum `std::result::Result<_, serde_json::error::Error>`
found enum `std::result::Result<_, simd_json::Error>`
error: aborting due to 2 previous errors
rtyler commented
Work going on in the simd
branch