Lazy loading: render the visible window and fetch the rest over HTTP as the reader scrolls
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- cpp, javascript
- 領域
- api, backend, performance
調査の方向性
Start with the text-file path in internal/html/text_file.cpp, then read internal/html/frontend.* and cli/src/server.cpp to understand how shipped scripts and HTTP-served fragments fit together. The issue suggests text files as the smallest end-to-end proof, but leaves the region API and transport details open. Done means rendering visible regions on demand while preserving current behavior for output opened without a server.
索引モデルが issue の本文から書いたものです。
説明
Translation is all-or-nothing today: html::translate builds a service whose every view writes its whole content in one write_html pass, and that pass is what a big file dies in — #762 is a 1.4 MB ods taking 1.2 GB before any view exists. The html limits do not help, because spreadsheet_limit / spreadsheet_cell_limit bound what is written, not what is read to get there, and cutting content is a compromise anyway (#740, #757).
For anything large — a spreadsheet with 100k rows, a 900 page pdf, a deck of 200 slides, a 50 MB log file — the reader only ever looks at a screenful. We already ship an HTTP server (odr::HttpServer, cli/src/server.cpp) that serves a connected HtmlService by path, and the views already ship their own scripts (viewport, search). That is most of the substrate for rendering the visible window plus a safety margin up front, and fetching the rest on the fly as the reader scrolls.
What exists to build on
HtmlConfig::page_range_begin/page_range_end— the only partial render there is: static, whole-service, honored only by the pdf pipeline.HtmlFragmentView(internal/html/document.cpp) — a document is already cut into fragments, one per sheet / slide / drawing page, each its own view and its own file, withdocument.htmlwriting all of them. Coarse laziness at view granularity, and the place a finer one attaches.HtmlView::sheet_cut()— a view already reportscontentvsrenderedextent, i.e. the vocabulary for "what is there" vs "what I gave you".HttpServerroutes/file/<prefix>/<path>intoHtmlService::exists/mimetype/write/write_html, so a fragment route is an addition rather than a new server.internal/html/frontend.*writes the shipped css/js and can locate them as resources instead of embedding — where a loader script would go.
Which content, and on what axis
Every format wants this eventually; they differ in how much structure is already there to cut along.
| content | today | region axis |
|---|---|---|
text files (internal/html/text_file.cpp) |
one text.html, the whole text held as a std::string and streamed twice — once for the line-number gutter, once for the body |
line ranges. Closest thing to a sheet's rows, and the only shape here with no element tree in the way at all |
| spreadsheets (ods/xlsx/xls/csv) | one fragment per sheet; each writes every cell in one pass | row ranges, possibly column ranges too for very wide sheets |
one view per page, page_range_* already renders a subset |
page ranges | |
| presentations (odp/pptx/ppt) and drawings (odg) | already one fragment per slide / page, so a view is already a screenful | slide / page index — the split exists, but building any one fragment still parses the whole document, and a host scrolling a deck continuously still pulls every fragment |
| text documents (odt/docx/doc/rtf/md) | a single document.html for the whole thing, no split at all |
block index, or page ranges when text_document_margin renders pages. The hardest: reflowing content has no coordinate before it is laid out |
Text files are the cheapest end-to-end proof — trivial region axis, no engine work — while spreadsheets and pdf are where the pain actually is, and text documents are where the geometry problem below has no easy answer.
Sketch
Three layers, roughly in this order:
1. Translation engine — render a region without parsing the whole document.
A view needs to be able to write rows [a, b), lines [a, b), or pages [a, b) at a cost proportional to the region rather than the document. Today every engine builds its full element registry up front, so this is the deep part of the work: the sheet path in particular needs the row/cell parse to be skippable and resumable, and the element adapters need to admit random access into a sheet or page without walking everything before it. For presentations and drawings the fragment split already gives the axis, and the work is that building one fragment must stop parsing the other 199. Whatever bounds memory here also fixes #762 as a side effect.
2. HtmlService / HtmlView API — ask a view for a piece of itself.
Something like a region descriptor (line / row / block / page range) plus a write_html variant that takes one, and metadata for the whole extent so a client knows what it may ask for. The skeleton written up front has to carry stable anchors the fragments splice into, and enough geometry (row heights, page boxes) that scroll position is stable before a fragment arrives — a lazily grown document that resizes under the reader is worse than a cut one. bring_offline must keep meaning "materialize all of it".
3. HTTP + JS — a loader.
A fragment route on the server, and a shipped script that watches the viewport, requests the regions it needs with a margin ahead of the scroll direction, splices them in, and evicts what is far away. It should degrade to today's behaviour when nothing serves it, since the same output is written to disk and opened as a file.
Things to decide
- Region vocabulary. Lines, rows, pages, slides and blocks are five axes; is one generic descriptor right, or a per-shape one?
- Geometry of reflowing content. Rows, lines and pages can be sized before they are rendered, so a placeholder holds the right space. A text document's blocks cannot — the placeholder is a guess, and correcting it moves the reader. May mean text documents only lazy-load in the
text_document_marginpage shape, at least at first. - Where the state lives. A service holding a partially parsed document across requests is a cache with a lifetime and an eviction policy, and
HtmlServiceis currently stateless per request beyondwarmup(). - Hosts without an HTTP server. The bindings (wasm, jni, apple) render into a web view, and only some of them will want to run a server; a fragment fetch may need to go through a host-supplied callback instead, which argues for the fragment API being the primitive and HTTP being one transport over it.
- Editing / back-translation.
editableoutput andgenerateDiff()assume the whole document is in the page; a lazily loaded one is not. - Search.
odr.search()searches the DOM, which will no longer hold everything.
Scope
Big, and worth splitting. Text files are the smallest thing that exercises all three layers and could go first as the shape of the API. Layer 1 then lands per engine, starting with ods/xlsx and pdf (the formats that hurt), with presentations and drawings following as "parse one fragment, not the deck". Text documents last, once the geometry question has an answer.
- 主要言語
- C++
- スター
- 41
- フォーク
- 10
- 平均マージ
- 12時間 4分
- マージ済み PR(30日)
- 297
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opendocument-app/OpenDocument.core のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
opendocument-app/OpenDocument.core#1211 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
opendocument-app/OpenDocument.core#1210 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
opendocument-app/OpenDocument.core#1209 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
opendocument-app/OpenDocument.core#1208 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
opendocument-app/OpenDocument.core#1207 ·
メンテナーはふだん 1 日以内に返信
opendocument-app/OpenDocument.core の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA-Omniverse/usd-brep#23 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
qbittorrent/qBittorrent#25121 ·
メンテナーはふだん 2 日以内に返信
-
SVT-AV1: Unnecessary size padding対応中かも @pszemus が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
strukturag/libheif#1945 ·
メンテナーはふだん 1 日以内に返信
-
v9.6.0: CMake incorrectly enforces presence of libevdev対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
mltframework/shotcut#1943 ·
メンテナーはふだん 1 日以内に返信