mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-19 19:50:52 +00:00
Currently the `wasm-gc-api` crate doesn't expose `parity_wasm::Module` as a public dependency which means that whenever we want to run a GC (which is twice per `wasm-bindgen` invocation) we have to serialize and reparse the module a lot! The `wasm-bindgen` has to serialize, `wasm-gc` then parses, `wasm-gc` then serializes, and `wasm-bindgen` then parses. This commit sidesteps all of these operations by ensuring that we always use the same `parity_wasm::Module` instance, even when multiple versions of the `parity_wasm` crate are in use. We'll get a speed boost when they happen to align (which they always should for `wasm-bindgen`), but it'll work even if they aren't aligned (by going through serialization). Concretely on my machine this takes a `wasm-bindgen` invocation from 0.5s to 0.2s, a nice win!