Repository navigation
Hold Log frames while the list is scrolling - #93
Merged
Merged
Conversation
Every frame the phone gets while the Log is moving costs its main thread a pass over the list, and traces put most of the stutter right after one lands. Until now every visible-range report (every 20 rows) moved the drawn rows, so nearly every report sent a frame. While the list moves, a report now keeps the frame as it was unless the screen is within 50 rows of the edge of the rows drawn, or the end of the list is within 40 rows with a next page here. The time is pinned for those renders and for the poll, so a minute ticking over doesn't change the frame either. When the list comes to rest (mobile-ui's new on-scroll-end), the rows are drawn around the screen again and the times catch up. Once you've scrolled, held pages also go in while the list is at rest, one after another as they land, until 80 rows sit below the screen. That gives the next fling room before it needs a page mid-scroll. Opening the log still only fetches one page ahead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simonhamp
force-pushed
the
perf/log-scroll-phase
branch
from
October 26, 2026 19:21
e1bdbfd to
1735d17
Compare
simonhamp
marked this pull request as ready for review
October 26, 2026 19:22
1 task done
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.
The Log sends the phone fewer frames while you scroll. Each frame that lands mid-fling costs the iPhone's main thread a pass over the list. The b4 to b8 traces put most hitches just after one, and until now nearly every visible-range report (every 20 rows) sent one, because each report moved the rows drawn.
While the list is moving, a report now leaves the frame as it was unless one of these is true:
RowWindow::Reserve). They reach 150 rows ahead, so that's about every 100 rows instead of every 20.NextPageWithin, as before).Those renders, and the 30 second poll, keep the time of the frame before them, so a "4m" turning "5m" doesn't change the frame either. php-bin-mobile already drops a frame identical to the last one, so nothing reaches the phone.
When the list comes to rest it calls
scrollEnded()through mobile-ui's newon-scroll-end(NativePHP/mobile-ui#177). The rows are drawn around the screen again and the times catch up. A frame then can't make the scrolling stutter.Once you've scrolled, pages also go in while the list is at rest, one after another as they land, until 80 timeline rows sit below the screen (
NextPageAtRestWithin). That gives the next fling room before it needs a page mid-scroll. Opening the log still fetches only one page ahead.On Simon's iPhone 16 Pro, release builds, 75 seconds each of flinging down Following with 2 to 3 second pauses. Before is main (9ea6362) with mobile-ui main, after is this branch with mobile-ui#177, both on the same mobile-air shell. The screen counts as moving when the app drew frames in the 300 ms before.
Before, 13 hitches ended within 0.35 s of a frame sent mid-scroll. After, none did. The slow frames now land once the list has stopped, where a late frame holds up an update for a few frames instead of interrupting the motion. It's one hand-scrolled run each, so read the at-rest numbers loosely.
What to watch for:
on_scroll_endprop fails, and on a phone the Log would never hear that the list stopped. It still works then, with the rows drawn moving every 100 rows or so and pages going in near the end.NextPageAtRestWithinsends fewer.Tests:
RowWindowTestcovers the rows drawn staying put until the screen nears either edge, and never nearing an edge that's the end of the feed or the top rows.LogPageFramesTestchecks the frame stays byte-identical mid-scroll, poll included, with the times catching up at rest.LogPrefetchTestcovers topping up at rest, holding pages that land mid-scroll, and opening the log fetching one page ahead. Five existing tests now draw around the screen, or stop the list, before checking the rows drawn. The full suite passes with mobile-ui#177 through a local path repo.Screenshots
Nothing looks different. The change is in how often frames reach the phone while you scroll, which a trace shows better than a recording.
🤖 Generated with Claude Code