26. Performance and Large-File Strategy
Performance and Large-File Strategy requirements from the authoritative Glitchpad Technical Specification.
Whole-file buffering is permitted only inside the format limits below and only when peak decoded memory remains inside the renderer budget. Seek-capable sources use ranged reads for PDF and bounded probes. Stream-only Android sources may use an application-private cache when a renderer requires seek; the cache obeys source-size, quota, privacy, revision, and cleanup rules.
| Workload | Full capability | Degraded capability | Refusal threshold |
|---|---|---|---|
| Markdown | ≤ 16 MiB rendered and editable | 16–32 MiB source editing without live preview; 32–256 MiB large-text view | > 256 MiB |
| Standalone Mermaid | ≤ 1 MiB source, 2,000 edges, 8 MiB sanitized SVG, 5 s render | 1–32 MiB source editing without preview; 32–256 MiB large-text view | > 256 MiB source or any renderer hard limit for preview |
| Embedded Mermaid | ≤ 256 KiB per block, 64 blocks and 1 MiB aggregate Mermaid source per Markdown document; 2,000 edges, 8 MiB output, and 5 s per block | Source remains available while over-limit blocks show independent fallbacks | Parent Markdown threshold governs source; renderer hard limits govern each preview |
| Text/source | ≤ 32 MiB editable and highlighted | 32–256 MiB virtualized read-only plain text | > 256 MiB |
| Raster image | ≤ 100 megapixels and decoded budget | Preview thumbnail when available | > 200 megapixels or decoded hard budget |
| PDF desktop | ≤ 512 MiB, 10,000 pages | Reduced cache and thumbnails disabled | Above source/page hard limit |
| PDF Android | ≤ 256 MiB, 10,000 pages | Reduced cache and thumbnails disabled | Above source/page hard limit |
| DOCX/ODT | ≤ 128 MiB compressed and expansion limits | Images omitted after decoded-image budget | Any archive hard limit |
Work is chunked around the UI event loop. Main-thread tasks SHOULD remain below 16 ms and MUST NOT repeatedly exceed 50 ms during interaction. Syntax, Markdown, Mermaid, PDF, image, checksum, and office work is cancellable. Mermaid allows one current request per owner and two active render contexts application-wide. Switching tabs prioritizes active content and suspends background rendering.
Performance tests use small, medium, boundary, and hostile fixtures with stable digests. A claim is invalid without the fixture, host, WebView, build profile, sample count, and measurement output.