Skip to content

v5.0.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@Birch-san Birch-san released this 06 Jul 22:33
· 51 commits to master since this release
e84d17f

Do not use: introduces performance/size regression due to building without optimizations enabled. Prefer v6.0.2

Added support for WebAssembly SIMD acceleration (in supported browsers). This can make specific parts of the code 4x faster (but performance overall is unlikely to be dramatically different).

package.json now specifies the entrypoint to the library as entry.js (rather than pointing directly to Box2D.js). entry.js uses wasm-feature-detect to determine whether SIMD is available on your platform. It will then load in either Box2D.js or Box2D.simd.js as appropriate (after which, said .js file will load in Box2D.wasm or Box2D.simd.wasm respectively).

If you import the ES module distribution of box2d-wasm: entry.js will use ES2020 dynamic import() and ES2017 await to load in Box2D.js or Box2D.simd.js.
The browsers which support dynamic import and async/await are very similar to the ones which support WebAssembly.
You may find that you need to reconfigure your bundler. The Svelte/Rollup demo demonstrates a working configuration (format: 'esm' is the important part).

If you import the UMD module distribution of box2d-wasm: entry.js will use CommonJS require() to load in Box2D.js or Box2D.simd.js.