Closes #228.
Parsing got slower after early October through two feature commits that run a Character-level search on every line or list item:
- 6c7e17c (radio targets):
SettingsScanner.scancalls Foundation'scontains("<<<")on every line holding<. 19% of the single-section parse. - 0cc0e6b (description item tags):
Parser.descriptionTagwalks every-/+/*item line backwards by Character. 8 to 14% of the parse.
Both now test bytes first (containsBytes); the Character search still decides. lineClass checks the first byte before each hasPrefix, table rows find | by byte and confirm by Character, and OrgParser.parse keeps its input as the tree's text instead of rebuilding it. Parse trees are identical to main's on 62 files (csg.org, work notes, docs, test fixtures). The round-trip tests now compare tree.root.text, which is still built from the tokens.
Open path: startup folds skip layout invalidation (nothing is laid out yet; 21 ms for 6,000 drawers), Wrappers.all and shadedBlocks make no node per paragraph, LineIndex.reset reads the text in blocks, and spelling marks are cleared only when spell checking was on.
Gates, ORGSTAR_GATES=1 swift test -c release --filter GateTests, M2 Pro, median of four alternating runs, machine shared with other builds:
| File | Measure | main | branch | Gate |
|---|---|---|---|---|
| Single 1 MB section | open | 134 ms | 85 ms | 100 ms |
| typing / blank line p95 | 9.8 / 11.9 ms | 9.8 / 11.1 ms | 16 ms | |
| memory | 33.0x | 31.5x | 45x | |
| 5,000-row table | open | 49 ms | 38 ms | 100 ms |
| typing / blank line p95 | 4.6 / 10.3 ms | 4.6 / 9.1 ms | 16 ms | |
| memory | 42.0x | 41.4x | 45x | |
| 3,000 entries with drawers | open | 116 ms | 68 ms | 100 ms |
| typing / blank line p95 | 9.2 / 9.4 ms | 9.5 / 9.2 ms | 16 ms | |
| memory | 22.8x | 19.3x | 45x | |
| csg.org (1,545 kB) | open | 121 ms | 71 ms | 155 ms |
| typing / blank line p95 | 11.4 / 11.9 ms | 10.8 / 11.2 ms | 16 ms | |
| memory | 11.1x | 9.9 to 10.0x | 10x |
Tests: swift test green apart from the known timing flake AgendaModelTests.checksFilesOffTheMainActor, which passes alone. Both Xcode builds succeed.