Skip to content

perf(coreNode): split children update loop on childUpdateType#15

Merged
chiefcll merged 1 commit into
mainfrom
perf/hoist-child-update-loop
May 11, 2026
Merged

perf(coreNode): split children update loop on childUpdateType#15
chiefcll merged 1 commit into
mainfrom
perf/hoist-child-update-loop

Conversation

@chiefcll
Copy link
Copy Markdown
Contributor

Summary

The children update loop in CoreNode.update had a per-iteration if (childUpdateType !== 0) compare even though that value is invariant across the loop. Split it into two specialized loops based on whether childUpdateType is zero — one fewer compare per child per frame, which adds up for nodes with many children.

Behavior is identical to the previous combined loop.

Test plan

  • pnpm test — 146/146 passing
  • pnpm build — clean
  • 2 new unit tests lock in the contract for both branches:
    • inherited childUpdateType cascades into children whose updateType was 0
    • with no inherited bits, only children with pending work are walked
  • Visual regression — recommend running locally; no math/render changes

🤖 Generated with Claude Code

The inner loop had a per-iter `if (childUpdateType !== 0)` compare even
though that value is invariant across the loop. Split into two
specialized loops based on whether childUpdateType is zero — saves one
compare per child per frame, which adds up for nodes with many children.

Behavior is identical to the previous combined loop; two unit tests lock
in the contract for both branches:
- inherited childUpdateType cascades into children whose updateType was 0
- with no inherited bits, only children with pending work are walked

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@chiefcll chiefcll merged commit 619200a into main May 11, 2026
1 check passed
@chiefcll chiefcll deleted the perf/hoist-child-update-loop branch May 11, 2026 14:42
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