Skip to content

Vector tiles read by one MVT reader in Rust, the TypeScript and former Rust readers gone - #629

Merged
graffkevin merged 5 commits into
mainfrom
vector-tiles-mvt
Nov 29, 2026
Merged

graffkevin merged 5 commits into
mainfrom
vector-tiles-mvt

Conversation

@graffkevin

Copy link
Copy Markdown
Collaborator

First slice of the vector tiles port to the target (#536): one MVT reader, in Rust.

  • crates/technique/graphic-engine (isard-graphic-engine): formats::protobuf, the generic protobuf reader (named errors, varints without allocation).
  • crates/domain/layers (isard-layers): vector_tiles::mvt, the MVT reader into columns (TileLayer, TileFeature, GeometryType).
  • The TypeScript decoder (Pbf included) and the former Rust data/mvt.rs and data/pbf.rs are deleted. The workers, the glyphs, LiDAR HD, the native app and the fuzz target read through the new reader; data/mvt.ts only presents the Rust columns as TileFeatures.
  • The tessellation module is renamed the vector tiles module (isard_vector_tiles, option vectorTilesWasmUrl, no shim). Its JS boundary stays in legacy/crates/core/src/module.rs for now (one wasm download in the worker), written as a temporary exception in docs/contribute/target.md: the whole read and tessellate task moves to bindings/ with slice 3.
  • A trap of the module re-creates it with fresh memory (wasm-bindgen's --experimental-reset-state-function, this module only), reported once; a malformed tile is an error, reported once by the worker pool.
  • docs/contribute/target.md: the decisions of 29 November (crate names kept, one upload total per frame, the slice's open points).

Contract test

tests/fixtures/mvt.json, generated by scripts/test/mvt-fixture.ts from @mapbox/vector-tile 3.0.0 on pbf 5.2.1 over recorded tiles already in the repo (Paris z14 OpenFreeMap and PLAN IGN, Alps z12, world z1, a small z14, OGC API NRW, the LiDAR HD index), edge cases and malformed tiles. It passed on the former TypeScript and Rust readers first (second commit), then on the new one, read by a TypeScript test and a Rust test.

Performance against main

Frames, 3 runs a side, alternated, Apple M5, quiet machine: no path slower.

example metric main branch diff noise verdict
vector-3d fps 60 60 0 3 within noise
vector-3d frame p95 (ms) 16.7 16.8 +0.1 0.5 within noise
vector-3d heap (MB) 42 42 0 30 within noise
vector-3d main thread (ms/frame) 2.6 2.5 -0.1 0.5 within noise
vector-night fps 60 60 0 3 within noise
vector-night frame p95 (ms) 16.7 16.7 0.0 0.5 within noise
vector-night heap (MB) 116 117 +1 30 within noise
vector-night main thread (ms/frame) 4.1 4.1 0.0 0.5 within noise
react/vector-3d fps 60 60 0 3 within noise
react/vector-3d frame p95 (ms) 16.8 16.7 -0.1 0.5 within noise
react/vector-3d heap (MB) 44 44 0 30 within noise
react/vector-3d main thread (ms/frame) 2.5 2.5 0.0 0.5 within noise
wind fps 60 60 0 3 within noise
wind frame p95 (ms) 16.7 16.8 +0.1 0.5 within noise
wind heap (MB) 14 15 +1 30 within noise
wind main thread (ms/frame) 4.1 4.0 -0.1 0.5 within noise
wind-streets fps 60 60 0 3 within noise
wind-streets frame p95 (ms) 16.7 16.7 0.0 0.5 within noise
wind-streets heap (MB) 25 26 +1 30 within noise
wind-streets main thread (ms/frame) 3.7 3.6 -0.1 0.8 within noise

Decoding a tile and reading every feature, median ms, alternated runs, quiet machine (bun = JavaScriptCore, node 22 = V8):

tile JSC main JSC branch V8 main V8 branch
Paris OpenFreeMap z14 (1.18 MB) 6.28–6.46 5.04–5.17 16.7–17.5 7.99–8.13
Paris PLAN IGN z14 2.07–2.08 1.60–1.62 4.96–5.24 2.12–2.20
Alps z12 0.180–0.182 0.152–0.154 0.37–0.41 0.217–0.221
world z1 0.802–0.805 0.712–0.716 1.55–1.63 1.39–1.41
small z14 (5 KB) 0.0347–0.0362 0.0338–0.0345 0.062–0.065 0.049–0.050

Size: isard_vector_tiles_bg.wasm +5.4 KB gzip (56.3 KB), accepted; budgets at the measured size + 5 %.

Part of #536.

…ad total per frame, and the vector tiles slice's open points settled
…formed tiles reported once, the contract test on the recorded tiles in place

The tessellation module becomes the vector tiles module (isard_vector_tiles_bg.wasm, vectorTilesWasmUrl, the
vectorTilesModule message). A trap of the module makes its instance again with a fresh memory instead of stopping the
worker; a malformed tile is an error marked as such, the first one reported by the pool. The MVT reader's names are
the same in Rust and TypeScript (TileLayer, TileFeature, GeometryType, ValueType), its errors split. The contract test
reads the tiles where the visual tests recorded them, its tolerance in the fixture. The budgets are the measured sizes
plus five per cent, and the temporary export from the former base is written in target.md and bindings/README.md.
…e, not thirteen a layer

The vector tiles module gives where each layer's columns are in its memory in one header (VectorTile::columns), and data/mvt.ts copies them out from there: a small tile is no longer slower to read than with the former TypeScript reader in JavaScriptCore. The budgets follow the sizes measured.
@graffkevin
graffkevin merged commit d44d8a5 into main Nov 29, 2026
9 checks passed
@graffkevin
graffkevin deleted the vector-tiles-mvt branch November 29, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant