Repository navigation
perf(page): tag page body waits for table paint - #13435
Merged
tiensonqin merged 1 commit intoSep 26, 2026
Merged
Conversation
A tag page held its bidirectional properties, block tree and linked references behind a fixed 800 ms timer, so that the objects table's first view-data request leaves in its own batch. The timer ran on every tag page, whether the table had answered after 10 ms or not at all. Release the body when the objects table reports its first window, through the on-first-table-paint! callback class-objects already passes to the view. The view reports only after that window's view-data request has answered, so the body's snapshot requests always leave after it. The 800 ms stays as a cap for a table that never reports. The release callback keeps its identity across renders: a new function per render would defeat the memo of the tabs and re-render the table when the body is released.
tiensonqin
force-pushed
the
fix/tag-page-first-paint
branch
from
September 26, 2026 12:57
c06957a to
627f045
Compare
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.
What changes
A tag page no longer holds back its body (bidirectional properties, block tree, class children, linked references) for a fixed 800 ms. The body now mounts once the objects table has its first window. The 800 ms stays only as a cap for a table that never reports. On an imported graph of about 150k blocks, a warm tag page showed its first screen of blocks after 201-529 ms instead of 888-1007 ms (medians per page), and a cold one after 837-979 ms instead of 1008-1299 ms.
Mechanism
#13226 wrapped the body of a class page in
after-first-paint, which renders nothing until asetTimeoutof 800 ms fires. The purpose was to let the objects table's first:view-datarequest leave in its own snapshot batch, before the children tree and the linked references ask for theirs. The timer runs the same 800 ms whether the table answered after 10 ms or not at all, so on a warm open the page below the table stayed empty for about 700 ms with the renderer idle.class-objectsalready hands:on-first-table-paint!to the view.view-innercalls it from its mount effect, andsub-viewmountsview-inneronly after the first-window:view-dataresponse has arrived.page-innernow passes a release callback throughtabstoclass-objects, which calls it next to its ownset-first-paint-done!. The new hookuse-below-fold-readyreturns[ready? release!].ready?is true at once on pages that are not tags. On tag pages it becomes true onrelease!or when the 800 ms cap fires.release!is memoized withuse-callback, becausehsx/defccompares component arguments with=, and a new function on every render would re-rendertabsand the table at the moment the body is released.The release follows the first-window response, so the body's snapshot requests always leave after that request. They now queue in
subs-loaderbehind the table's second:view-datarequest, which asks for the remaining rows and flushes first as a view resource. In request logs of 12 tag-page opens (4 tags, cold and warm) on master and on this branch, the first-window request carried only that resource and was sent before any body request every time.The 800 ms delay of the reference count in
loaded-pageis unchanged. The body'sreferencescomponent asks for the same resource when it mounts.Numbers
Desktop release builds of master (
d9d625847) and of this branch, each shipped as only the renderer bundle in the same nightly app shell, on the same imported graph (2086 pages, about 147k blocks). Each run relaunches the app per page, then opens the page cold and twice warm. The builds alternate run by run, with 3 runs per build (4 forergodic theory). Medians in ms from navigation to the frame after the DOM change:Pagetag, 2686 objects, body is the add-button rowOn a cold open the body still waits for the table's remaining-rows request (152-518 ms in these runs), which walks the sort index when there is no row limit. A separate pull request, "perf(views): sort small sets without a row limit", addresses that for tags with up to 1000 objects. On the 92-object tag warm, the median time to the table's first rows was later on this branch (275 ms against 110 ms, ranges 124-314 and 90-143 ms over 3 runs). The body now mounts in the same frames as the table, so its first render can run before the table's rows paint.
Tests
frontend.components.page-first-paint-test: the newclass-page-body-waits-for-the-first-table-window-testruns the hook with stubbeduse-state,use-callbackanduse-effect!. A page that is not a tag is ready without a timer. A tag page waits and arms the 800 ms cap. The release callback is memoized with empty deps and sets the state to true. Once released, the cap is cleared. The old assertion that the delay is at least 400 ms is kept as a check on the cap.frontend.components.page-first-paint-test,frontend.components.page-test,frontend.db.subs-loader-test,frontend.db.subs-test,frontend.components.views-test,frontend.components.journal-test: 0 failures, run withTZ=Etc/GMT+12andTZ=Pacific/Kiritimati.TZ=Etc/GMT+12and once withTZ=Pacific/Kiritimati: 2477 tests, 12415 assertions each. The only failures are the 3 zone-dependent tests that fix(test): build test dates in local time #13430 fixes (6 assertions at UTC-12, 4 at UTC+14), the same as on master.Allow edits from maintainers.