Dual Routing Engine

"/home/yossef/notes/git/projects/maplibra/decisions/Dual Routing Engine.md"

path: maplibra/decisions/Dual Routing Engine.md

- **fileName**: Dual Routing Engine
- **Created on**: 2026-06-16 00:48:42

Dual Routing Engine

Purpose: Why the app supports both a JS routing engine and an optional WASM kernel.

Related: ../Home.md, ../Architecture.md, ../modules/Pathfinding.md, ../modules/WASM Routing.md

Decision

Maintain two routing engines with identical logic: a pure JS engine for compatibility and a WASM kernel for performance.

Rationale

  1. WASM is not universally supported — some browsers or environments disable WebAssembly
  2. WASM compilation can fail — large WASM binaries may timeout or OOM on low-end devices
  3. JS is the reliable fallback — always works, always available
  4. Parity verification — having both engines allows comparing results to detect bugs
  5. Performance gains — WASM can be 2-5x faster for A* on large graphs

Architecture

Rollout Behavior

Parity Mode

Tradeoffs

When It Was Made

Phase 5+ of the product hardening effort. The WASM kernel was added to improve routing performance on large campuses.