Skip to content

feat: C10 viewport culling, spatial index and perf lane (RFC + PR1 measure + PR2 culling) - #93

Merged
davcs86 merged 30 commits into
mainfrom
claude/roadmap-next-items-7y0lrz
Oct 8, 2026
Merged

davcs86 merged 30 commits into
mainfrom
claude/roadmap-next-items-7y0lrz

Conversation

@davcs86

@davcs86 davcs86 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

C10 — spatial index, viewport culling, perf budget (closes H6). This PR now carries the approved RFC and implementation plan plus PR1 (measure) and PR2 (culling); PR3 (label LOD / ceiling note) is not started.

  • RFC / plan: docs/design/2026-10-06-c10-spatial-index-culling-perf/ (design.md, plan.md, recon.md, measurements.md).
  • PR1 — measure: seeded fixture generators, harness-only Storybook harness stories, perf Playwright project, perf.yml, probes P1–P4.
  • PR2 — culling (default on, inert below 5,000 drawn elements):
    • core/spatial (SpatialIndex seam, FlatIndex, elementBounds, CULL_* constants) and the Culling feature: synchronous SHOW on zoom, hide-budgeted (300/frame) rAF pass, CSS fail-open self-check.
    • Culled elements keep their <g>, accessible name and focus (one data-pfd-transient attribute plus one CSS rule); exports strip the attribute.
    • ViewerOptions.culling, BaseElement <title> refresh on update, palette placement at the viewport centre.
    • Gates: correctness lane G1–G7 for the interactive and editor arms, an index⇄model property test, and a blocking ON-arm frame-time ceiling (perf-budget.json, 40 ms; derived from one pinned CI run).

Notes for review

  • exportSVG() is quadratic in DOM size (pre-existing), so G5 asserts DOM parity (ON minus the transient attribute == OFF) instead of a byte-compare through the export.
  • The free-list for slot reuse stays conditional (not promoted).
  • Whether the perf job is a required check is a branch-protection setting.

Test plan

  • pnpm lint, pnpm format:check, pnpm typecheck, pnpm test, pnpm build, pnpm build-storybook
  • Local e2e: culling, culling-probes, fixture, harness-filter, interactions
  • CI green on this head (VR, a11y, perf ceiling)
  • Reviewer sign-off

🤖 Generated with Claude Code

https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk

claude added 22 commits October 7, 2026 00:01
…pproved design (deep, 5 rounds)

Recon dossier + design.md for ROADMAP C10: hide-the-paint-keep-the-<g> culling
(AT-discoverable), pure flat-scan index behind a seam, blocking frame-time gate,
three-PR plan. ROADMAP C10 row marked design-approved; ledger entry appended.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…xes in design/recon

Adds plan.md for the approved C10 design; corrects out-of-range path:line cites
in recon.md/design.md and the module key typo (__init__). Plan review in progress.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…cing, args encoding, deps)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…view Log

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…flags, AX/focus/stroke probes)

Verified against installed deps and real Chromium: storybook build has no
--exclude-tags (use STORYBOOK_DEPLOY-gated stories globs), CDP AX tree (not
ariaSnapshot) is the G4 oracle, getBoundingClientRect excludes stroke, culled
<g> keeps AX name and focus, core imports cleanly from Playwright specs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…tures, culling/perf harness stories

Steps 1-3 of the approved C10 plan: loadStories({includeHarness}), iframeUrl/gotoStory args,
mulberry32-seeded fixture data + moddle XML builder (SMALL ~2.7k, LARGE ~23k), and the
Tests/Culling Harness + Tests/Perf Harness stories (tagged harness-only). No runtime change
to any published package.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
Steps 4-5: playwright perf project declared only under PERF=1 (chromium ignores perf.spec.ts),
test:perf script, and perf.spec.ts measuring the culling-off baseline on the ~23k fixture via
CDP Performance.getMetrics + rAF deltas. Baseline: boot ~9.8s, pan frame p95 ~117ms.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…ration, core import guard)

Step 6: small-fixture probes run in the required e2e lane. Verifies via the real CDP AX tree that a
culled <g> keeps its role/name, focus lands on it, getBoundingClientRect excludes stroke, and
@d3-polytree/core imports from a spec; records per-class painted-extent overhang (pad input) and
label-estimator calibration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
… bulk write, sweep, hide variants)

Step 7: in-page microbenchmarks plus real-DOM measurements on the ~23k fixture: scan p95 0.3ms;
bulk hide/show of 23k <g> costs 1.2-2.7s main-thread (style recalc dominated) for every mechanism;
unculled pan cost sweep vs drawn-element count; Editor-vs-interactive overhead. Adds a nodes arg
to the harness stories.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…ness opt-out

Step 8: perf workflow in the pinned Playwright container (continue-on-error in PR1 only; no budget
yet), and build-storybook:deploy which drops the two large harness stories from the Pages site via
STORYBOOK_DEPLOY-gated globs (Storybook 8.6.18 has no --exclude-tags).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…an statuses and deviation log

Step 9: records the baseline (23,040 elements: pan frame p95 ~117ms, boot ~9.8s), the §9 trigger
results (chunked hides FIRED: hiding 23k <g> costs 1.2-2.7s for every mechanism; dual-pad trigger
ill-posed; CULL_MIN_ELEMENTS data points to ~5,000 not 1,000), probe outcomes and overhang
calibration. Plan Steps 1-9 marked done; execution stops here per the plan's contingency.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…000, cost-based dual-pad trigger

User-directed after PR1's measurements fired the design §9 contingency: hide pass budgeted at
HIDE_BUDGET=300/frame (stateless rescan), CULL_MIN_ELEMENTS=5,000 with a ~10.6k correctness fixture
(new plan Step 10a), dual-pad trigger reworded cost-based (new G7), free-list re-measured in PR2.
design.md amended in place; plan.md amends pending steps only (Steps 1-9 untouched).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…, G7 record-only)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…-ratio measurement)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…10 step 10a)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…tre fix (C10 steps 10-20)

- core/spatial: SpatialIndex seam, FlatIndex, elementBounds, CULL_* constants
- core: Culling feature (sync SHOW, hide-budgeted rAF pass, inert rules, CSS self-check)
- canvas: TRANSIENT_ATTR + clone-only strip on export
- viewer: ViewerOptions.culling; interactive-viewer registers cullingModule and ships the rule
- core: BaseElement title refresh on update; palette places at viewport centre

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…e check (C10 steps 21-22)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…ditor arms (C10 step 23)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…rm recording (step 24 prep)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…p 24)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
Regenerated packages/element/src/styles.generated.ts with the repo tooling.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
@davcs86 davcs86 changed the title docs(design): C10 spatial index, viewport culling & perf budget — approved RFC feat: C10 viewport culling, spatial index and perf lane (RFC + PR1 measure + PR2 culling) Oct 7, 2026
claude added 7 commits October 7, 2026 21:05
…; restore G5 byte-compare (C10)

- core/spatial FlatIndex: LIFO free-list, capacity tracks peak live count
- canvas getSvgString: de-duplicate selector matchers (export was O(N^2) in DOM size)
- storybook: G5 compares exportSVG ON vs OFF byte-for-byte again

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…ontent-visibility, drain)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…r 3 rounds

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
…nings addressed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016V6PyVUq4G2LMR9EfXZEMk
@davcs86
davcs86 merged commit 9924ed2 into main Oct 8, 2026
5 checks passed
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.

2 participants