Improve editor loading performance for Very large documents
See https://community.manuscripts.io/t/limitations-to-manuscript-io/274 – as we know the editor loading time / bandwidth usage is right now scaling linearly with the size of the document (the number of sections, elements in them etc) and to able to do better, some sort of virtualisation scheme is needed. Related, there have been some requests for the "focus mode" from the Mac app (which brings a specific section into focus without presenting the rest of the document without an action taken to "Load more" either before or after the focused section). These two needs are related in the sense that good performance with very large documents would involve loading to the editor only defined subsets of the document tree, and lazily (directed by scrolling attempts for example) would load more of it. Further, remembering last edited section and the outline state is of course also related.
In short (this is more to start the conversation – other approaches may work better / be necessary?) I think the following should be done at the editor level (inspector may present its own problems beside these):
-
At some threshold manuscript size (heuristic), start lazily loading content into the editor, only hydrating to the editor the subtree that is presently plausibly visible. -
Scrolling to the beginning / end should lead to further parts of the document being hydrated. -
(already saved) content away from currently edited position can be dehydrated and removed from the editor. -
Editor position should be remembered on the device. -
Outline state should be remembered on the device.