Skip to content

Re-link only parents whose child list changed - #94

Merged
andreamancuso merged 1 commit into
mainfrom
core/relink-unchanged-parents
Nov 21, 2026
Merged

andreamancuso merged 1 commit into
mainfrom
core/relink-unchanged-parents

Conversation

@andreamancuso

@andreamancuso andreamancuso commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Every publication called YGNodeRemoveAllChildren on every owned node and re-inserted every child, so the frame after any commit laid out the whole tree again. This re-links a parent only when its child list changed, it is new, or it is being destroyed. The commit protocol, validation and receipts are unchanged.

Measured through xframes-core (xframes-project/xframes-core#21), one changed row per commit, hidden window, medians of 15 commits:

Rows (nodes) Frame after a commit, before → after Frame with no commit
500 (2,001) 10.9 → 3.2 ms ~3 ms
1,000 (4,001) 38.4 → 5.6 ms ~5.5 ms
2,000 (8,001) 168.5 → 12.5 ms ~11–13 ms

New test: PublicationRelinksOnlyParentsWhoseChildrenChanged checks that a sibling subtree whose children did not change keeps a clean Yoga layout. The existing reorder, move and removal tests cover moved children. xframes-core's native and rendered checks pass against a library built with this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_0186WhMU3KjnmjR7Y4r49GrT

Summary by CodeRabbit

  • Improvements
    • Updating a parent’s children no longer triggers unnecessary layout updates in unchanged parts of the interface. The updated child hierarchy is reflected in the layout, and replaced children are removed.

Every publication removed the Yoga children of every owned node and
inserted them again. That marks the whole layout dirty, so the frame
after a commit laid out the whole tree again, even when one row changed.
A parent is now re-linked only when its child list changed, it is new to
the publication, or it is being destroyed. Moved children still leave a
parent whose list changed or a destroyed one before being attached.

Measured through xframes-core (xframes-project/xframes-core#21), one
changed row per commit, hidden window: the frame after a commit at 2,000
rows (8,001 nodes) went from 168.5 ms to 12.5 ms, which is what a frame
without a commit costs. The protocol, validation and receipts are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0186WhMU3KjnmjR7Y4r49GrT
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ApplyCommitOperations now relinks Yoga children only for parents whose ownership or child list changed. A publication test checks the dirty state, resulting child lists, and destruction of a replaced child.

Changes: Yoga child relinking

Layer / File(s) Summary
Conditional relinking and publication test
packages/dear-imgui/cpp/app/src/xframes_commit.cpp, packages/dear-imgui/cpp/tests/xframes_test.cpp
ApplyCommitOperations removes and inserts children only for parents selected for relinking. The test checks that the changed parent is dirty, unchanged parents and a child are not dirty, child lists are correct, and the replaced child is destroyed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: Minimal · up to dceb6

This change avoids relinking every Yoga parent on each publication and so reduces frame cost after a commit. No concrete defect was identified, and the change is reversible by a normal revert. The risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Re-link only parents whose child list changed" matches the main change in xframes_commit.cpp. ApplyCommitOperations now re-links Yoga children only for candidate parents that are newly owne…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Re-link only parents whose child list changed" matches the main change in xframes_commit.cpp. ApplyCommitOperations now re-links Yoga children only for candidate parents that are newly owned, absent from the prior hierarchy, or whose child list differs. The PR objectives describe the same goal of avoiding re-linking every Yoga parent on each publication. The added test PublicationRelinksOnlyParentsWhoseChildrenChanged supports this. The title is specific and describes the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 01e796a0-a1eb-4674-be50-4d29e7af3364
Commits

Reviewing files that changed from the base of the PR and between f372379 and dceb641.

Files selected for processing: 2

  • packages/dear-imgui/cpp/app/src/xframes_commit.cpp
  • packages/dear-imgui/cpp/tests/xframes_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@andreamancuso
andreamancuso merged commit dceb641 into main Nov 21, 2026
6 of 11 checks passed
andreamancuso added a commit to xframes-project/xframes-shared-c-library that referenced this pull request Nov 21, 2026
The xframes submodule now tracks main. The core/virtual-table branch was
merged there (xframes-project/xframes#93), followed by a fix that
re-links only the parents whose child list changed
(xframes-project/xframes#94). The frame after a commit no longer lays out
the whole tree: at 8,001 nodes it went from 168.5 ms to 12.5 ms in
xframes-core's measurement (xframes-project/xframes-core#21). The C ABI
is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0186WhMU3KjnmjR7Y4r49GrT
@andreamancuso
andreamancuso deleted the core/relink-unchanged-parents branch November 21, 2026 15:01

This branch was previously deployed

1 inactive deployment
github-pages — dceb6414 Deployed Nov 21, 2026 by andreamancuso via deploy #273
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