Spun out of PR #72. For a Linux-scale repo (~80k files and 100k+ commits) the world rendering hangs. PR #72 shipped the safe/bounded wins; this tracks the architectural work that needs a measured approach.
Already done in #72
- Media image fetches batched —
POST /api/files (one round trip per ~32 images instead of one GET per billboard).
- Firefly orb cap (
MAX_FIREFLY_ORBS = 200k) — orbs = trees × authors-per-commit, previously uncapped.
Already optimized (verified, no action needed)
- Icon atlas is memoized by
tree_signature (city/state/index.ts:233).
- Trees capped at
TREE_MAX_CELLS = 100k (city/components/trees/treePlacement.ts:97).
- Layout runs off-thread; buildings are instanced (one
InstancedMesh per cell); decoration defers past paint.
Remaining bottlenecks to profile + fix (ranked)
- Worker payload clone — the full manifest structured-clones into the layout worker and ~80k building objects clone back out (
city/layout/index.ts). The treeDecorationProfile bench already simulates full-vs-slim clone. Explore a geometry-only return payload (the main thread re-associates file/dir by path).
- Picker pickables — rebuilt as a flat list of all ~80k buildings + trees on every
cityRevision/decorationRevision bump (city/interaction/picker.ts). No spatial index / distance LOD; raycasts test everything.
- Street-label textures — one canvas +
measureText + GPU upload per street, no LOD (skip tiny/short streets; cache by label text).
- bbox computed — O(buildings+streets) with per-point
Vector3 allocations (city/state/index.ts); reuse scratch vectors, early-exit on reuse applies.
Approach
Profile first. Build a headless large-repo bench (80k files / 100k commits) that times each apply phase (layout return, buildings assembly, picker refresh, bbox, decoration), so we fix the phase that actually dominates with a before/after number — rather than guessing. The golden bench only covers the decoration pass, so any change to the buildings/picker paths needs its own guard.
Context: the full audit lives in the PR #72 thread.
Spun out of PR #72. For a Linux-scale repo (~80k files and 100k+ commits) the world rendering hangs. PR #72 shipped the safe/bounded wins; this tracks the architectural work that needs a measured approach.
Already done in #72
POST /api/files(one round trip per ~32 images instead of one GET per billboard).MAX_FIREFLY_ORBS = 200k) — orbs = trees × authors-per-commit, previously uncapped.Already optimized (verified, no action needed)
tree_signature(city/state/index.ts:233).TREE_MAX_CELLS = 100k(city/components/trees/treePlacement.ts:97).InstancedMeshper cell); decoration defers past paint.Remaining bottlenecks to profile + fix (ranked)
city/layout/index.ts). ThetreeDecorationProfilebench already simulates full-vs-slim clone. Explore a geometry-only return payload (the main thread re-associatesfile/dirby path).cityRevision/decorationRevisionbump (city/interaction/picker.ts). No spatial index / distance LOD; raycasts test everything.measureText+ GPU upload per street, no LOD (skip tiny/short streets; cache by label text).Vector3allocations (city/state/index.ts); reuse scratch vectors, early-exit on reuse applies.Approach
Profile first. Build a headless large-repo bench (80k files / 100k commits) that times each apply phase (layout return, buildings assembly, picker refresh, bbox, decoration), so we fix the phase that actually dominates with a before/after number — rather than guessing. The golden bench only covers the decoration pass, so any change to the buildings/picker paths needs its own guard.
Context: the full audit lives in the PR #72 thread.