Skip to content

Routing V2: incremental grid router in a web worker - #333

Merged
milanofthe merged 8 commits into
mainfrom
feature/routing-v2
Sep 13, 2026
Merged

milanofthe merged 8 commits into
mainfrom
feature/routing-v2

Conversation

@milanofthe

Copy link
Copy Markdown
Member

Replaces the edge router with an incremental engine that runs in a web worker. Port handles and the 10px grid are unchanged.

  • Orthogonal A* on the grid: node interiors impassable, margins and port stubs passable at extra cost
  • Negotiated congestion keeps different nets off shared grid lines; fan-out shares a trunk
  • Only affected connections are rerouted after changes; routes are published per connection
  • Waypoints are routed optimally as a whole, no loops around waypoints
  • Canvas nodes and edges use raw state, edge highlights are computed centrally
  • Zoom-out limit lifted, assembly animation capped at 2 s
  • Old router and unused pathfinding dependency removed
  • Vitest added with routing invariants, scenario generator and benchmark (npm test, npm run bench:routing)

Measurements with 1000 connections:

  • Engine, full routing: about 0.2 s, no overlap between nets (old router: 26 s)
  • Production build, headless Chrome: load 3.8 s, block drag median 16.7 ms per frame, hover 16.7 ms (before: 50 s load and 4 s per frame while dragging, dev build)

@milanofthe
milanofthe merged commit 7091fc1 into main Sep 13, 2026
4 checks passed
@milanofthe
milanofthe deleted the feature/routing-v2 branch September 13, 2026 15:33
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