Huge WASM binaries
I've written a simple game in Rust (with wasm-bindgen, rendering with glow). When I include gilrs, the WASM binary size increases considerably. This is primarily caused by gamecontrollerdb.txt
included with include_str!
. In gilrs/no-include-str, this include is removed. I also tried to use just gilrs_core. Although the axis values seem to be incorrect sometimes (probably, I interpret the raw values in a wrong way), the binary size has decreased further.
In the version without gamepad, gamepad support can be alternatively integrated (in this simple case) with about 500 bytes JavaScript code calling Navigator.getGamepads()
and passing the results to an input method of the game impl exported with #[wasm_bindgen]
.
wasm | wasm.gz | js | js.gz | |
---|---|---|---|---|
gilrs | 473389 | 96077 | 29940 | 5570 |
gilrs/no-include-str | 159029 | 56536 | 29940 | 5574 |
gilrs_core | 102063 | 39039 | 29940 | 5576 |
without gamepad | 89642 | 34731 | 25697 | 4955 |