WASM Terrain Bench
Four implementations of the same Minecraft world generation pipeline: JavaScript (deepslate, the parity oracle), Rust → WASM, C++ → WASM (emcc) and AssemblyScript → WASM. Same seed, same region, biomes + heightmap + trees + flowers. Four previews side by side show whether the variants agree deterministically, and the table below gives the raw timings.
How the benchmark works
- All variants get an identical
TerrainInput(seed + center + radius + MC version + features flag). - JS uses deepslate as the parity oracle. Rust/C++/AS are currently v0 heuristics, so their checksum will not match JS until they are replaced by a port of pumpkin-world.
- The variant with the shortest time gets a green border.
- The L1 cache (LRU, 4096 chunks, ~16 MB) keeps data between runs. The "Clear cache" button resets it.
- A worker pool keeps JS off the main React thread, so the UI doesn't freeze at radius 128.
- Versions 1.18-1.26: worldgen JSON bundles are lazy-loaded from
/data/worldgen-X.json. Missing bundles are greyed out.
Building the WASM artifacts
See apps/web/wasm-terrain/BUILD.md. Short build.sh scripts in the
rust/, cpp/ and as/ directories generate files into /public/wasm/terrain/.
The bench marks a variant as "build needed" if its artifact is unavailable.