Repository navigation
perf(db): flush block trees before resources - #13437
Merged
Merged
Conversation
subs-loader sends one render-snapshot request at a time and picked each request by kind in the order view resources, resources, blocks, children. On a page open the page's children request (open-block-tree, the body) was queued behind the title's reactions, comment threads, display properties and favorite status, and behind the linked references' blocks and breadcrumbs, so it left after about 12 serial requests. Flush blocks and children before other resources. View resources (view-data, views) still leave first and alone, so a tag page's first table window keeps its own request ahead of everything else.
tiensonqin
force-pushed
the
perf/snapshot-order
branch
from
September 30, 2026 10:59
999dd29 to
de1335f
Compare
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Sep 30, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
devin-ai-integration Bot
pushed a commit
that referenced
this pull request
Oct 1, 2026
subs-loader sends one render-snapshot request at a time and picked each request by kind in the order view resources, resources, blocks, children. On a page open the page's children request (open-block-tree, the body) was queued behind the title's reactions, comment threads, display properties and favorite status, and behind the linked references' blocks and breadcrumbs, so it left after about 12 serial requests. Flush blocks and children before other resources. View resources (view-data, views) still leave first and alone, so a tag page's first table window keeps its own request ahead of everything else.
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 1, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 4, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 8, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
devin-ai-integration Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
subs-loader sends one render-snapshot request at a time and picked each request by kind in the order view resources, resources, blocks, children. On a page open the page's children request (open-block-tree, the body) was queued behind the title's reactions, comment threads, display properties and favorite status, and behind the linked references' blocks and breadcrumbs, so it left after about 12 serial requests. Flush blocks and children before other resources. View resources (view-data, views) still leave first and alone, so a tag page's first table window keeps its own request ahead of everything else.
devin-ai-integration Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
subs-loader sends one render-snapshot request at a time and picked each request by kind in the order view resources, resources, blocks, children. On a page open the page's children request (open-block-tree, the body) was queued behind the title's reactions, comment threads, display properties and favorite status, and behind the linked references' blocks and breadcrumbs, so it left after about 12 serial requests. Flush blocks and children before other resources. View resources (view-data, views) still leave first and alone, so a tag page's first table window keeps its own request ahead of everything else.
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 11, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 13, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 16, 2026
logseq#13545, logseq#13546 and logseq#13547 replace the 9 open pull requests they bundle; logseq#13468, logseq#13437, logseq#13475 and logseq#13528 are in upstream master.
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
subs-loadernow sends the render-snapshot requests for blocks and children before the other resources. View resources (:view-data,:views) still leave first and alone. On a page open, the page's children (the body) no longer wait behind the title's reactions, comment threads, display properties and favorite status, or behind the linked references' blocks and breadcrumbs. On an imported graph of about 150k blocks, a cold open of a page that is not a tag showed its first screen of blocks 100-446 ms earlier (medians per page, 9 pages of 9 to 742 blocks); pages of 9-21 blocks went from 415-436 ms to 111-219 ms.Mechanism
Since #13226,
subs-loaderkeeps oneget-render-snapshotsrequest in flight and picks each request by kind in the order[:view-resources :resources :blocks :children](flush-kind-order). Components ask for data as they render, so every answer queues more requests: the page block's answer mounts the title, the body and the references at once, and their requests land in the same batch. The body's[:children page-uuid]then waits until no resource is pending. On cold opens of 3 pages (13, 92 and 742 blocks) that request left at 208-485 ms, after 11 other snapshot requests: the page identity, favorite status, the page block, the title's decorations, the linked references' view, view data, blocks and breadcrumb, and the rows' decorations. On the 92-block page the title's decorations request alone took 257 ms in the worker.The order is now
[:view-resources :blocks :children :resources]. The view-resource group is unchanged, so a tag page's first-window:view-datarequest still leaves in its own request ahead of any block or children request (the reason #13226 split it out). The request limits per kind and the single request in flight are unchanged. Resources now wait until the queued blocks and children are sent, so the title's decorations and the rows' reactions, comment threads and display properties arrive after the rows; during a burst of block requests (a long scroll) they wait for the burst.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 (3240 pages, about 154k blocks). Pages sampled across the graph's size range; each run relaunches the app per page, then opens the page cold and twice warm. The builds alternate run by run, 3 runs per build. Medians in ms from navigation to the frame in which the first screen of the page's blocks is in the DOM:The page's children request moved from 208-485 ms to 45-70 ms, now after only the page identity and the page block. Tag pages do not change, since their body waits for the 800 ms timer of #13226 (#13435 replaces that timer). Warm opens send the same requests in the same order on both builds, and none of them is a block or children request (the renderer's cache holds them), so the ordering does not act on them. The warm medians differ by -17 to +60 ms, and 3 runs do not separate those differences from the spread between launches: in a separate logged run, master took 111 ms on the third open of the 21-block page (64-76 ms in the timed runs) and 237 ms on the warm open of the 389-block page (159-214 ms), inside this branch's ranges.
Request logs of 5 tags (2 to 2686 objects), each opened cold and twice warm, on master, on this branch, and on this branch combined with #13435: in all 15 opens per build the first-window
:view-datarequest carried only that resource and no body request (children, bidirectional properties, page membership, linked references) left before it.Tests
frontend.db.subs-loader-test:request-groups-flushes-block-trees-before-resources-test(renamed fromrequest-groups-flushes-resources-before-block-trees-test) now expects the groups view resources, blocks, children, other resources, and keeps the check thatblock-ref-countdoes not share the first table window request.frontend.db.subs-loader-test,frontend.db.subs-test,frontend.components.page-first-paint-test,frontend.components.page-test,frontend.components.views-test: 0 failures, run withTZ=Etc/GMT+12andTZ=Pacific/Kiritimati.TZ=Etc/GMT+12and once withTZ=Pacific/Kiritimati: 2476 tests, 12407 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.