awslabs / aws-lambda-rust-runtime

A Rust runtime for AWS Lambda
Apache License 2.0
3.36k stars 343 forks source link

Support simd_json as an optional alternative to serde_json #934

Open bassmanitram opened 1 month ago

bassmanitram commented 1 month ago

THIS IS A DRAFT PR TO MAKE KNOWN WHAT I'M PLAYING AT - PLEASE DO COMMENT AS YOU SEE FIT

The approach is to abstract all original serde_json references to a new lib crate in the workspace - json-impl.

That crate as a feature swicth between serde_json and simd_json. In

The initial phase, is to to get all the other crates to depend on json-impl with the serde feature, instead of serde_json directly, so in the end nothing should change.

The next phase is to activate the simd feature and see what fails, then start mitigating the failures.

📬 Issue #, if available:

✍️ Description of changes:

🔏 By submitting this pull request

bassmanitram commented 1 month ago

I have run NO tests yet, even for the serde_json abstraction.

bassmanitram commented 4 weeks ago

(Where's the bang-head-against-wall emoji when you need it!) - so, up to now, the mut and unsafe stuff - well we can deal with it and it's nicely encapsulated to the json-impl crate (and probable feature propagation as this matures).

Oh but simd_json isn't done with us yet, and this one requires some serious mods to simd_json - https://github.com/simd-lite/simd-json/issues/398 - so we're kinda blocked until that's solved.

(But, then again, one of my suggestions in that issue is a feature pulling simd_json Value representation closer to serde_json, so PERHAPS we can encapsulate ALL - or most - of the issue mitigations in such a feature)