Repository navigation
Conversation
A held fragment used to be the nested tree that came off the wire, and every frame walked it, normalized each node's children and rebuilt each attribute bag with attrsFor(). Nothing in that changes between frames. applyFragment() now holds the fragment prepared: three flat lists in pre-order (type, child count, attribute bag). emit() walks those lists and calls the collector's open(), leaf() and close() as before, so the collected tree is the same. paint() prepares its nodes the same way. In the binary-wire experiment this took a 1,202-node list from about 8.9 ms to 8.0 ms per frame, and moved about 1.7 ms onto receipt. Most of what is left is the collector itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests run on PHP 8.3 and 8.4 for every pull request and for pushes to main. composer.lock is ignored, so the install resolves fresh each time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A server region used to hold its fragment as the nested tree that came off the wire. Every frame walked that tree, normalized each node's children and rebuilt each node's attribute bag with
attrsFor(). None of that changes between frames.Now
applyFragment()holds the fragment prepared: three flat lists in pre-order with each node's type, child count and attribute bag.emit()walks those lists and calls the collector'sopen(),leaf()andclose()the same as before, so the collected tree doesn't change.paint(), which server screen chrome uses, prepares its nodes the same way.This came out of the binary wire experiment. On a 1,202-node list it took a frame from about 8.9 ms to 8.0 ms, and added about 1.7 ms when the fragment arrives. Those numbers were measured in mobile-air before the client moved here, not re-measured in midgard. Most of the remaining frame time is the collector itself, so caching a region's collected subtree between frames would be the bigger win. That isn't in this PR.
Things to check in review:
ServerRegionTestcovers several roots, siblings and nesting levels, and checks a held fragment paints the same on two frames.open()does, throughfragmentFor().708 tests pass locally. A local checkout needs
composer update nativephp/mobilefirst, because thecomposer.locklying around has no entry for it (the lock is gitignored).This PR also adds CI, which midgard didn't have.
.github/workflows/tests.ymlruns Pest on PHP 8.3 and 8.4 andpint --test, on every pull request and on pushes to main. The install iscomposer updatesince there's no committed lock, so a run picks up whatever is on mobile-air'sidea/asgardat the time. The Kotlin and Swift tests undertests/Nativeare not run.🤖 Generated with Claude Code