sbuffkin_hexmaker/dev
isaprettycoolguy@protonmail.com e74bc0d6f6 fix: eliminate O(n²) layout thrash in renderCoordLabelsLayer (open-time stall)
renderCoordLabelsLayer read each hex's offsetWidth/offsetLeft/offsetTop and
created the label DOM inside the SAME loop. Every offset read after a DOM write
forces a synchronous layout flush, so the loop was O(n²): on the chult map
(3843 hexes) opening stalled the main thread ~21s (regression from commit
10475fd, the coord-label layer).

Split into a read phase (collect all hex geometry into an array) then a write
phase (create all labels) — matches the read-then-write pattern already used by
renderPathOverlay/renderFactionOverlay. ~21s → ~0.1s (dev/coord-label-thrash-
bench measures ~198× batched vs interleaved).

Bakes in a regression guard: CLAUDE.md convention forbidding interleaved
layout-read / DOM-write in per-hex loops, plus the committed benchmark.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 06:57:16 -04:00
..
.gitignore feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
bg-hex-alignment-sandbox.html fix: grid expand/shrink preserves bg image alignment (1.4.1) 2026-06-17 18:18:53 -04:00
calibration-outline-overlay-sandbox.html feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
coord-label-thrash-bench.html fix: eliminate O(n²) layout thrash in renderCoordLabelsLayer (open-time stall) 2026-06-30 06:57:16 -04:00
coord-label-thrash-bench.mjs fix: eliminate O(n²) layout thrash in renderCoordLabelsLayer (open-time stall) 2026-06-30 06:57:16 -04:00
coord-slip-sandbox.html fix: coord labels no longer slip up-left during zoom bake 2026-06-21 11:09:12 -04:00
hex-calibration-sandbox.html feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
screenshot-approaches.mjs feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
snapshot-bg-hex-alignment.mjs fix: grid expand/shrink preserves bg image alignment (1.4.1) 2026-06-17 18:18:53 -04:00
snapshot-calibration-outline.mjs feat: background image + grid calibration mode (1.4.0) 2026-06-17 17:01:24 -04:00
snapshot-coord-slip.mjs fix: coord labels no longer slip up-left during zoom bake 2026-06-21 11:09:12 -04:00