3 ms·
> Attempted Fix: Skip the JSON Round-Trip > We integrated serde-wasm-bindgen So you're reinventing JSON but binary? V8 JSON nowadays is highly optimized [1] an
by szmarczak 7mo ago
> Attempted Fix: Skip the JSON Round-Trip
> We integrated serde-wasm-bindgen
So you're reinventing JSON but binary? V8 JSON nowadays is highly optimized [1] and can process gigabytes per second [2], I doubt it is a bottleneck here.
[1] https://v8.dev/blog/json-stringify https://v8.dev/blog/json-stringify
[2] https://github.com/simdjson/simdjson https://github.com/simdjson/simdjson
- kam 7mo agoNo, serde-wasm-bindgen implements the serde Serializer interface by calling into JS to directly construct the JS objects on the JS heap without an intermediate serialization/deserialization. You pay the cost of one or more FFI calls for every object though. https://docs.rs/serde-wasm-bindgen/ https://docs.rs/serde-wasm-bindgen/
- szmarczak 7mo agoIndeed, you're right. However, it still needs to encode and decode strings. WASM just needs native interop.