Skip to content

perf(reader): keep large documents responsive while scrolling - #60

Closed
Lanlan13-14 wants to merge 1 commit into
usamaiqb:mainfrom
Lanlan13-14:perf/window-large-documents
Closed

Lanlan13-14 wants to merge 1 commit into
usamaiqb:mainfrom
Lanlan13-14:perf/window-large-documents

Conversation

@Lanlan13-14

Copy link
Copy Markdown

Summary

  • Opening or scrolling a Markdown file of a few hundred kilobytes stalls the reader, because the whole rendered document is laid out and drawn by a single text view.
  • Documents past 24,000 characters are now split into paragraph-bounded chunks of at most 12,000 characters, and only the chunks near the viewport are mounted. Everything else stays a spacer, so the scroll range, table of contents and search still cover the whole document.
  • Shorter documents, raw view and the editor preview are unchanged and keep the single text view.

Test plan

  • ./gradlew test, lint, detekt and assembleRelease pass on the fork's CI.
  • Open a Markdown file of a few hundred kilobytes and scroll quickly from top to bottom; the reader should keep up instead of freezing.
  • Jump to a heading near the end from the table of contents and confirm it lands on that heading.
  • Search for a word that occurs late in the document and step between matches.
  • Switch between rendered and raw view and confirm the reading position is kept.
  • Open a short Markdown file and confirm it renders exactly as before, including code blocks and tables.

A document of a few hundred kilobytes was laid out and drawn in full by
one text view, which stalled opening and scrolling. Split documents past
24k characters into paragraph-bounded chunks and mount only the chunks
near the viewport, keeping the rest as spacers so the scroll range still
covers the whole document.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant