Skip to content

Commit

Permalink
doc: mention inferior type support of JSON approach (#3047)
Browse files Browse the repository at this point in the history
  • Loading branch information
gthb authored Aug 30, 2022
1 parent 823f576 commit 2e1b344
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion guide/src/reference/arbitrary-data-with-serde.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ requires a lot of calls back and forth between Rust and JavaScript, which can
sometimes be slow. An alternative way of doing this is to serialize values to
JSON, and then parse them on the other end. Browsers' JSON implementations are
usually quite fast, and so this approach can outstrip `serde-wasm-bindgen`'s
performance in some cases.
performance in some cases. But this approach supports only types that can be
serialized as JSON, leaving out some important types that `serde-wasm-bindgen`
supports such as `Map`, `Set`, and array buffers.

That's not to say that using JSON is always faster, though - the JSON approach
can be anywhere from 2x to 0.2x the speed of `serde-wasm-bindgen`, depending on
Expand Down

0 comments on commit 2e1b344

Please sign in to comment.