Skip to content

Wall batching stays live in cutaway - #761

Merged
wass08 merged 4 commits into
mainfrom
perf/wall-mode-batch
Sep 4, 2026
Merged

Wall batching stays live in cutaway#761
wass08 merged 4 commits into
mainfrom
perf/wall-mode-batch

Conversation

@wass08

@wass08 wass08 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Metric

Charter backlog 3c: idle frame cpu in cutaway should match the full-height number on the rich fixtures (the mode users edit in loads walls unbatched today).

What changes

Cutaway never changes wall geometry: WallCutout (viewer, useFrame priority 0) swaps each wall's material array by camera facing and stamps userData.wallHidden. The merged wall batch already released tinted walls every frame, so hidden walls take the same path — released the frame the stamp appears (this system runs at priority 5, same frame), excluded from candidates and from the re-merge drift count, re-sewn at settle when they come back. Mode flips between up and cutaway no longer dispose every level. down, translucent and isolation still stand the batch down.

window.__wallBatch.stats() is exposed under ?perf so scripted runs can read wall batch membership (the panel's batch row only covers node batching).

Before / after (private scripts/perf/run-scaling-matrix.ts, same machine, load avg 5–6)

fixture mode at load idle frame cpu post-hover idle
rich 4× (356 walls, 540 items) cutaway 16.9 → 14.0 ms (−17%) 18.9 → 15.9 ms
rich 2× cutaway 8.4 → 8.4 ms 8.6 → 8.4 ms
tower 2×18 full height 11.1 → 9.5 ms 11.6 → 10.2 ms
Maxi 8× full height 15.2 → 18.0 ms (noise; identical code path) 19.0 → 22.2 ms

Wall mode is persisted per project, so only the rich fixtures load in cutaway. In-page probe on the PR build: cutaway batches 164 of the rich-4× walls (172 hidden), 82 on rich-2×, 160 on Maxi-4×; cutaway vs full-height frame cost within 5 % on all three; draws −350…−580 at the load pose.

Gates

  • bun test packages/nodes: 1888 pass. New unit coverage: hidden walls are not candidates, a batched wall is released the frame its stamp appears, hidden walls do not count toward the re-merge threshold, released walls re-sew once visible and settled.
  • E2e against the PR build: perf-regression pack 5/5, click-batched-wall, click-hidden-wall, opening-placement-preview green; placement-preview-follows-cursor fails identically on base (pre-existing).
  • Visual parity (canvas screenshots, cutaway load pose / after orbit / full height / cutaway again): ≤ 0.28 % differing pixels on rich 2×/4×; Maxi 4× post-orbit poses differ by an orbit end-pose shift only.
  • Bake parity: Maxi 1× and rich 2× bakes identical in triangles, meshes, primitives, nodes and materials.

Follow-ups (not here)

Camera flips still cost a re-sew at each orbit stop in cutaway; keeping hidden walls resident (or moving walls onto NodeBatchStore) removes that. The rich-4× < 12 ms target needs ceilings + slabs coverage on top.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jmmz2AMwTzcnKsSHHPEMhN


Note

Medium Risk
Changes core rendering batching and cutaway interaction timing; mistakes could cause wrong walls drawn, missing picks, or hover glitches, though coverage is strong.

Overview
Wall merging now stays enabled in cutaway instead of tearing down every level batch on mode entry. canBatchWalls treats cutaway like up; down, translucent, and isolation still suspend batching.

Cutaway-hidden walls are handled like hover/selection releases: meshes stamped userData.wallHidden are skipped as batch candidates, released from the merged mesh the same frame the stamp appears (after WallCutout at priority 0), and excluded from the settle re-merge count so the batch can stay stable while most walls remain merged. When a stamp clears, the level is marked stale so visible walls re-sew after the usual settle window.

Re-merge and candidate collection use a combined excludedNodeIds set (cutaway-hidden plus tinted walls). ?perf sessions get window.__wallBatch.stats() for scripted batch metrics. Tests cover suspension rules, hidden candidates, per-frame release, settle behavior, visibility flip re-sew, and hover not blocking settle.

Reviewed by Cursor Bugbot for commit b4f6706. Bugbot is set up for automated code reviews on this repo. Configure here.

wass08 and others added 2 commits September 4, 2026 11:21
Cutaway never changes wall geometry: WallCutout swaps each wall's material
array by camera facing and stamps userData.wallHidden. The merged batch
already released tinted walls per frame, so hidden walls take the same
path — released the frame the stamp appears (WallCutout runs at priority
0, this system at 5), excluded from candidates and from the re-merge drift
count, re-sewn at settle when they come back. Mode flips between up and
cutaway no longer dispose every level; down, translucent and isolation
still stand the batch down.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jmmz2AMwTzcnKsSHHPEMhN
The panel's batch row covers node batching only; scripted runs had no way
to tell whether the merged wall batch was live in a given wall mode.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jmmz2AMwTzcnKsSHHPEMhN
@pascal

pascal Bot commented Sep 4, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 815fb384-88cf-4ca0-bcbb-565a4dc71626

Comment thread packages/nodes/src/wall/wall-batch-system.tsx
Releasing on the hidden stamp covered only half the flip: when the stamp
lifted nothing marked the level stale, so a wall that became visible again
drew itself until an unrelated edit re-sewed the floor. Bugbot caught it;
the parity probe confirmed it (rich-4× stayed at 172 batched walls after
returning to full height, now 352).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jmmz2AMwTzcnKsSHHPEMhN

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e264b67. Configure here.

Comment thread packages/nodes/src/wall/wall-batch-system.tsx
They aliased the same Set, so tinted walls leaked into last frame's hidden
set and read as stamp lifts every frame — the settle window never closed
while anything was selected or hovered. Bugbot caught it. The regression
test hovers one wall after a flip and expects the other eight to re-sew.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jmmz2AMwTzcnKsSHHPEMhN
@wass08
wass08 merged commit 16928b3 into main Sep 4, 2026
3 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.

1 participant