Repository navigation
docs: design lazy loading in three levels - #1246
Merged
Merged
Conversation
The browser fails before core does: a text file of one million lines takes 151 s to load in Chrome. The same page in chunks with `content-visibility: auto` loads in 1.5 s, offline and with no script. The design builds on that: 1. Containment: chunks that the browser does not lay out. 2. A window: the page keeps a far chunk as a string. 3. On demand: core renders a chunk that the host asks for. Levels 1 and 2 also work in an offline file. Text files go first, because they need no engine work. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
The chunked page that loaded in 1.5 s was laid out wrong. Its gutter took the 5120 px of `contain-intrinsic-size` as its width, so the text column was 32 px wide. Measured on a correct page: - With `content-visibility: auto`, the first frame comes after 13.5 s. Chrome lays out each chunk once to find whether it is near. - A chunk that is `hidden` until a script marks it near paints the first frame after 0.85 s. So level 1 starts each chunk `hidden`. That hides a far chunk from the find of the browser. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
The problem section said 151 s, the load time of the first measurement. The table states 154 s, the time to the first frame. Also state why each chunk sets the number of its first line: style containment keeps the counter inside the chunk. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN
This was referenced Oct 24, 2026
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.
🤖 Generated with Claude Code
Refs #764.
Summary
This adds
docs/design/lazy-loading.md, a proposal. The design rests on measurements:content-visibility: hiddenuntil a script marks them near the viewport, the same DOM paints its first frame in 0.85 s with 0.9 GB.autoalone takes 13.5 s, because Chrome lays out everyautochunk once on the first frame. With only a window of lines in the DOM, the page paints in 0.5 s.efficiency-big-1.odspeaks at 697 MB:content.xmlbufferThe three levels:
hiddenuntil a small script marks them near the viewport, withautoas the fallback when no script runs. It works offline, andodr.search, the editor, copy and print see all the content. The find of the browser does not reach a far chunk.So most of the work also helps a file that
bring_offlinewrites. Only level 3 needs a server.The order of work starts with level 1 for text files (#1247): chunks, plus line numbers as a CSS counter instead of the
ResizeObservergutter that doubles the load today.The second commit corrects the first one's level 1 numbers. The page that I measured first was laid out wrong.
Review fixes