From 2e1b344cba40b2cda9e544a9f494136b0ca1bbcc Mon Sep 17 00:00:00 2001 From: Gunnlaugur Thor Briem Date: Tue, 30 Aug 2022 11:42:01 +0000 Subject: [PATCH] doc: mention inferior type support of JSON approach (#3047) --- guide/src/reference/arbitrary-data-with-serde.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guide/src/reference/arbitrary-data-with-serde.md b/guide/src/reference/arbitrary-data-with-serde.md index c46e2464fd7..fba113b0689 100644 --- a/guide/src/reference/arbitrary-data-with-serde.md +++ b/guide/src/reference/arbitrary-data-with-serde.md @@ -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