Opening, saving and reloading files do coordinated I/O on the main actor #198

open cmc opened this on 2026-11-22 07:11 UTC · feature · milestone Backlog

Discussion

cmc 2026-11-22 07:11 UTC

Severity: Medium.

DocumentSession.open (Sources/OrgApp/DocumentSession.swift:253), save (:444) and fileChanged (:1083) call NSFileCoordinator reads and the save sequence (three reads, one write, one backup read: Sources/OrgDocument/Saving.swift:58-81) synchronously. On a local SSD a save is 7 ms for 1 MB and 35 ms for 10 MB; on iCloud Drive or a File Provider a coordinated read can wait on a download with the window blocked. Not measured on a sync folder. Do the I/O on a background task and apply the outcome on the main actor.

From the performance review, docs/review-2026-11-21.md (#96).

Platforms: macOS, iOS.