Repository navigation
fix(html): what a review of lazy loading found - #1267
Merged
Merged
Conversation
Search and loading in the page: - A search keeps the hits of a chunk that has not loaded as one run, not one object for each hit, and viewport.js keeps the index text folded, so a search for "e" over a million lines counts 5.1 M hits in 83 ms. - The index scripts of a group whose chunks have all loaded are not loaded, and the text of a chunk that loaded is not kept. - fold and the fold of the index take a surrogate pair as one character, so an astral capital counts the same in both. - A search that a new one replaces resolves its searchDone with null. - odr.chunks.show observes the chunk anew, so the observer takes it back once it is far. Without IntersectionObserver a chunk loads too. The observer takes the document as its root, where the browser can, so the margin works in a frame of another origin. - A sheet with no chunks (lazy_layout off) spills a written value without a TypeError, and a chunk that loads with a merge makes the sheet read its cells as merged. - A pdf page that loads draws its annotations again. Core: - A text chunk and an index script read a slice of the text, not a copy of all of it, so bring_offline of a million lines takes 3.9 s, not 9 s. - text-search/<n>.js with a huge n no longer wraps to group 0. - The pdf service guards its linked resources with a mutex of their own; a render of another view appended to the list while it was read. - The text render of a pdf page for the index reads no image, and a page script keeps its text for the index. - A linked SVM image states no file, because what it writes is SVG. - The group size of a search index is one constant for every view. Docs: the lazy_loading comments name every view, the npm package takes lazyLayout, and the plan lists the known limits. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
Each page script re-encodes its fonts for its own runs, as a page view does today; a digest names the files so that pages whose votes agree share one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
andiwand
force-pushed
the
fix/lazy-loading-review
branch
from
October 25, 2026 09:07
d40d4a9 to
44cd7dd
Compare
Three new lines in search.js and viewport.js went to 102 columns, where these files stay below 86. The step to a hit in a chunk that loaded names its offset again, as before the review. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN
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.
Three reviewers read the lazy loading work of #1246 to #1265: the core C++, the pdf writer, and the frontend scripts. This PR fixes what they found, and advances the reference output.
Search and loading in the page
{chunk, count}, not one object for each hit.viewport.jskeeps the index text folded, because only a search reads it. On a million lines, a search for "e" counts 5.1 M hits in 83 ms, and the heap is 225 MB.foldand the fold of the index take a surrogate pair as one character. Before,𐐨found an uppercase𐐀in a loaded chunk but not in the index.searchDonewithnull, not with the count of the new search.odr.chunks.showobserves the chunk again, so the observer takes it back once it is far. WithoutIntersectionObserver, a chunk now loads. The observer takes the document as its root where the browser can, so its margin also works in a frame of another origin.lazy_layoutoff spills a written value without aTypeErrorinreflow. A chunk that loads with a merge makes the sheet read its cells as merged. Before, a cell right of the merge named the wrong column.odr.chunks.fillreplaced the overlay.Core
bring_offlineof a million lines now takes 3.9 s, not 9 s.text-search/<n>.jswith a hugenno longer wraps to group 0.exists,mimetypeorwriteread it. This race is older than lazy loading, but page scripts make it frequent.file(), because what it writes is SVG.Docs and bindings
lazy_loadingcomments name every view.lazyLayout.Checked
Reference output (
1d5950adpublic,29f730f1private): 161 and 166 pages change. Each one, with the chunk classes and style removed and the two new error codes taken out, is the page as it was. Also changed: theresources/scripts.Review fixes
search.jsandviewport.jswent to 102 columns. They are wrapped below 86, as the rest of these files. The step to a hit in a chunk that loaded names itsoffsetagain.mainof the output repositories, that the lock order is alwaysm_mutexbeforem_resources_mutex, and that the pdf resource fonts are in anunordered_map, as the known limits say.viewport,sheet,annotation,textandbridge.sheet/dates.htmlandsheet/formula-words.htmlpassed on a second run, after the known load-timing flake.🤖 Generated with Claude Code
https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN