Skip to content

Algorithm Engine

Off-Main-Thread Graph & Sorting Sandbox at 60 FPS

Context
Roehampton University Honours & Open Source
Type
Motion & Interactive
Year
2025
Timeline
4 Weeks · 10,000+ Nodes @ 60 FPS
Artwork for Algorithm Engine

In plain language

Normally, displaying complex interactive data in a web browser feels like driving with the handbrake on: once you exceed a few hundred items, the page stutters and freezes. By moving the heavy math to background processor threads and drawing directly to the screen like a modern video game engine, we achieved fluid 60fps animation across 10,000+ data nodes with zero interface lag.

What it means for a business Proves how off-main-thread Web Workers and Canvas rendering can keep high-throughput, data-heavy enterprise dashboards perfectly fluid and responsive.

Measured results

60 FPS
Locked Frame Rate at 10,000+ Nodes
0ms
Main-Thread Blocking via Web Workers
18+
Graph, Tree & Sorting Algorithms
100%
Bidirectional Time-Travel Scrubbing
Standard DOM-based algorithm visualizers freeze the browser tab the moment a graph exceeds 400 nodes.

Most educational algorithm tools bind each array bar or graph vertex to a reactive DOM node and trigger state updates inside a setTimeout loop. Above a few hundred elements, layout thrashing and garbage collection lock the main thread, making it impossible to inspect how heuristic search or quicksort partitions behave at realistic scale.

An interactive combinatorial sandbox for visualizing pathfinding (A*, Dijkstra, Bidirectional BFS), sorting networks, and self-balancing trees across 10,000+ nodes with deterministic step-backwards time travel.

I decoupled algorithm execution from rendering entirely. Pathfinding and sorting generators run inside dedicated Web Workers, emitting compact Uint32Array state diffs over transferable ArrayBuffers. A custom HTML5 Canvas 2D renderer reads the active frame buffer and draws dirty regions at a locked 60fps, while an indexed ring buffer stores state snapshots so users can scrub backward and forward through every comparison and pointer swap.

  • Zero-copy transferable ArrayBuffer pipeline between Web Worker generators and the Canvas 2D compositor
  • Spatial quadtree hit-testing for instant cursor hover inspection and obstacle painting on dense grids
  • Deterministic seed replay allowing side-by-side algorithmic complexity comparisons on identical datasets

The engine sustains 60fps rendering across 10,000+ active nodes with 0ms of main-thread blocking. Students and engineers can mutate heuristic weights mid-search, compare A* against Dijkstra side by side, and step through call-stack frames without frame drops.

How it was built, step by step.

How we decoupled graph & sorting math into Web Workers to animate 10,000+ nodes with 0ms main-thread blocking.
  1. Cols 01–03 · Days 1–4

    Off-Main-Thread ArrayBuffer Protocol Design

    Replaced DOM-per-node reactivity with a zero-copy transferable Uint32Array snapshot protocol between dedicated compute workers and an HTML5 Canvas 2D compositor.

    PROTOCOL LOCKED0ms UI Thread Block

  2. Cols 03–06 · Week 1–2

    Web Worker Generators & Deterministic Time-Travel Ring

    Implemented A*, Dijkstra, Bidirectional BFS, Quicksort, and AVL rotations as deterministic generators writing into an indexed snapshot ring buffer.

    WORKERS VERIFIED100% Reversible Steps

  3. Cols 06–09 · Week 2–3

    Dirty-Rect Canvas 2D Compositor & Quadtree Painting

    Built spatial quadtree hit-testing so users can paint obstacles, drag heuristic weights, and scrub backward/forward across 10,000+ vertices at a locked 60fps.

    INTERACTION LOCKED60 FPS @ 10k Nodes

  4. Cols 10–12 · Week 4

    Frame-Timing Profiler & Academic Honours Release

    Profiled Chrome DevTools frame budgets under worst-case dense graphs (16.6ms ceiling) and shipped with keyboard accessibility and reduced-motion step mode.

    SHIPPED TO PROD6.4ms Frame Time

Stack

  • TypeScript
  • HTML5 Canvas
  • Web Workers
  • Algorithms
  • Motion & Interactive
  • UI/UX

Credits

Engine & Visualizer — Norbert Brett (br3tt) · Runtime — TypeScript, Web Workers & HTML5 Canvas 2D · Styling — Tailwind CSS