#188, backlinks. The pane's task is keyed on the file, the heading at the caret (start and title) and WorkspaceModel.indexVersion (new, bumped after each reconcile), not on editVersion. WorkspaceModel.backlinks is nonisolated and the Mac pane and the iOS screen call it from a @concurrent function. The regexes in Backlinks.links, Backlinks.context and Links.unescape are statics. A link typed in an unsaved buffer shows up when the heading at the caret changes or the file is saved, no longer after each pause.
#194, inspector. InspectorPane takes shown; its task does nothing while hidden and does not read editVersion. Shown, the columns and clock report are computed in a @concurrent function. Opening the inspector on a large file shows the previous content until the first result arrives.
#196, agenda. AgendaModel.sources stats the files and compares them with the cache inside the detached task. Invalidating from file events is not done: changedFile carries one path and rescans carry none, so the cache would need its own event feed.
Measurements, release build, throwaway harness (not committed):
| before | after | |
|---|---|---|
| Backlinks, file and heading pass, 5,000 links | 466 ms on the main actor | 169 ms off it |
| Backlinks, 49,400 links | 4.67 s on the main actor | 1.97 s off it |
Backlinks.links over 5,000 links |
105 ms | 19 ms |
| Inspector, 1 MB file, per pause | 163 ms on the main actor, shown or hidden | none hidden; 173 ms off the main actor shown |
| Agenda cache-hit refresh, 10,000 files, longest main-actor stall | 547 to 563 ms | 29 to 44 ms |
Results (link counts, rows, items) are the same before and after.
Tests: BacklinkTests.testsManyLinksWithoutCompilingPatterns, WorkspaceModelTests.findsBacklinks (called off the main actor), AgendaModelTests.checksFilesOffTheMainActor. The inspector's gate is in a view of the app target, which has no test target.
swift test and both Xcode builds pass.