docs/review-2026-11-21.md

main
orgstar/docs/review-2026-11-21.md rendered · source · history · blame · raw

488 lines · 55522 bytes

31 symbols in this file

orgstar review, 2026-11-21

Scope: issue #96. Speed, memory and energy, size, and code quality of the whole codebase at 1bdd0d3 (version 1.2.0 plus the roadmap handoff document). The review covers what can be measured from the command line on one Mac, and the Swift sources read for the code-quality questions. Nothing was measured on an iPhone, iPad or Watch, and nothing in Instruments' GUI; section 7 lists those with steps. Issue #109 (code scanning) is out of scope.

Facts, for calibration:

Version 1.2.0, commit 1bdd0d3
Size 403 Swift files and 104,801 lines under Sources/; ios/ holds the Xcode project, plists and assets, no Swift
Tests 1,148 tests in 10 test targets, 28,772 lines; all pass, with one exception described in 5.6
Machine MacBook Pro Mac14,10, Apple M2 Pro (8 performance and 4 efficiency cores), 16 GB
Software macOS 27.0.1 (26A434), Xcode 27.2 (27B52), Swift 6.4.2, Emacs 31.1
Power Low power mode off. The first test run and the Xcode builds ran on battery, the gates and benchmarks on mains

Method. swift test, the gates and both Xcode builds are the commands in CONTRIBUTING.org. Parse, index, agenda, save, export and table timings come from throwaway Swift Testing files run with swift test -c release and deleted afterwards; each number is the best of three runs unless a range is given. Synthetic inputs: a mixed document (headings with planning lines and drawers, paragraphs with markup, lists, tables, source blocks, footnotes) at 100 kB to 10 MB, and a folder of 10,000 files with eight headings each (19 MB). Launch and hang numbers come from the release Developer ID build (scripts/build-app.sh, arm64), started with the ORGSTAR_* development hooks against a throwaway data folder and a 1,003-file folder (14 MB, 59,751 headings, 49,400 links), with ORGSTAR_PERF=1 and log stream reading the perf category. Profiles are sample at 1 ms.

1. Verdict

The module structure is sound and the core is fast where it was measured before: parsing is linear at 85 ms per MB up to 10 MB, the index answers a search over 80,000 headings in 11 to 55 ms, saving a 10 MB file takes 35 ms, and tangling takes 155 ms per MB. Line coverage of the shared modules is 75 to 98 %, and a launch-open-quit run leaks nothing from the app's code.

Three things are wrong and affect ordinary use on the Mac today:

  1. The performance gates fail. Opening a file takes 5.6 times the gate (560 ms for the 1 MB section, gate 100 ms) because the editor restyles the whole file during init when stars are not hidden, which is the default. The change went in two days after the gates were recorded, and nothing runs the gates.
  2. The backlinks pane, shown by default, recomputes on the main thread after every pause in typing and builds a regular expression for every link in the workspace. With 49,400 links the window is blocked for 1.6 to 9.8 seconds at launch and again after each pause.
  3. Styling cost grows with the square of the file size. Styling 1 MB takes 1.2 s and 10 MB takes 129 s; typing in a 10 MB file takes 77 ms per key. The iOS editor styles the whole file synchronously at load, so it inherits the worst case.

Two defects lose data in narrow cases: shared captures on iOS are deleted from the inbox before they are filed, and several configuration writers replace a file they failed to read.

The largest size cost is structural: the widget and share extensions link all of OrgApp, 38 MB each as universal binaries with a 7 MB copy of SwiftMath's fonts, to read three JSON snapshot types.

2. Speed

2.1 Gates

ORGSTAR_GATES=1 swift test -c release --filter GateTests, four runs, medians. The earlier column is docs/plans/2026-10-04-performance.md, taken on an unnamed M-series Mac, so the ratios are indicative; the cause below does not depend on the machine.

File Measure 2026-10-04 Today Gate
Single 1 MB section open 76 ms 560 ms 100 ms fails
typing p95 7.0 ms 9.8 ms 16 ms
blank line p95 8.1 ms 11.1 ms 16 ms
memory 30.4x 38.1x 45x
5,000-row table (312 kB) open 38 ms 133 ms 100 ms fails
typing p95 3.2 ms 4.5 ms 16 ms
blank line p95 8.8 ms 10.0 ms 16 ms
memory 42.9x 50.7x 45x fails
3,000 entries with drawers (821 kB) open 236 ms 100 ms fails
typing / blank line p95 9.2 / 9.2 ms 16 ms
memory 24.7x 45x
csg.org (1,545 kB) open 75 ms 219 ms 155 ms fails
typing p95 6.5 ms 11.5 ms 16 ms
blank line p95 7.3 ms 12.0 ms 16 ms
memory 9.6x 11.6x 10x fails

Where the open time goes, for the 1 MB section: DocumentState(bytes:) 82 ms (the parse), OrgEditor(document:) 461 ms, scroll view and window 8 ms. A profile of OrgEditor.init puts 3,826 of 3,839 samples in restyle called from Sources/OrgEditorAppKit/OrgEditor.swift:125:

if !indented || !hideStars { restyleOutsideEditing(0..<utf16Length) }

hideLeadingStars defaults to false (Sources/OrgCore/Commands/Command.swift:71, Sources/OrgApp/UserConfig.swift:163), so with default settings every open styles the whole file before the first frame, and the chunked styling that load sets up two lines earlier does nothing useful. The line came in with 265b9d6 on 2026-10-06. In the app the same path shows as 387 ms in PaneView.makeEditor when the 1 MB file opens, 289 ms of it at this line.

The gates are skipped unless ORGSTAR_GATES is set, there is no CI, and no release script runs them, so the failure went unseen for six weeks. The M1 Air run (issue 2) is still owed.

2.2 Large files

The gate measurement applied to the mixed document:

1 MB 10 MB
Parse (OrgParser.parse) 85 ms 853 ms
Open in the editor 503 ms 18.9 s
Typing p95 7.5 ms 76.6 ms
Blank line p95 7.6 ms 77.5 ms
Editor heap over file size 36.4x 35.2x
Styling the whole file after open 1.17 s 129 s
DocumentState.apply, one character, ASCII text 0.2 ms 1.6 ms
DocumentState.apply, one character, text with umlauts 3.3 ms 33.5 ms
Outline (Presentation.outline) 2.5 ms 27 ms
Tree heap over file size 18.1x 17.8x

Styling is quadratic: 6.5 ms for 60 kB, 1.17 s for 1 MB, 129 s for 10 MB. The profile shows where: 2,369 of 3,826 samples are in NSMutableRLEArray insertObject:range: under NSTextStorage.addAttribute, moving the tail of the attribute run array. restyle (Sources/OrgEditorAppKit/OrgEditor+Styling.swift:19-57) first adds a paragraph style per line across the range, which creates one run per line, and then applies each role from the start, so every insertion shifts all the runs after it. The same shift is what makes typing in a 10 MB file take 77 ms: an edit in the middle restyles a paragraph in front of several hundred thousand runs. On the Mac the styling after open runs in run-loop turns, so the window stays usable while two minutes of work drain.

The document model has its own cost on non-ASCII text. DocumentState.applyGroup (Sources/OrgDocument/DocumentState.swift:85-105) copies the whole string per edit and finds positions with String.Index(utf16Offset:) (:178-182), which is linear when the string is not ASCII. One umlaut in a 10 MB file makes each keystroke cost 33.5 ms in the model alone, twice the 16 ms budget before any styling.

The iOS editor has no gates and no tests. MobileEditor.load styles the whole file synchronously (Sources/OrgstarMobile/MobileEditor+Styling.swift:12-18), restyleAll does so again when markup, spelling or images are toggled (:99-105), and files under 60,000 UTF-16 units are restyled whole on every edit (:166). It calls the same Presentation functions and the same attribute calls as the Mac editor, so the Mac's 1.17 s for 1 MB is about the best a phone can be expected to do, as one main-thread block at open, and a 10 MB file can be expected to run into the watchdog. Needs a device to confirm (section 7).

Folding and highlighting were not timed apart from the gates, which cover both. Table alignment is in 2.6.

2.3 Main-thread hangs over 100 ms

From the release app with ORGSTAR_PERF=1, which logs every main-thread wait of 100 ms or more.

Where Blocked Cause
Every launch two or three waits of 154 to 318 ms before the editor appears not profiled
Opening the 1 MB file 387 ms OrgEditor.init, 2.1
Backlinks pane, 1 MB file selected 1.6 s below
Backlinks pane, a small file with a heading selected 3.2 s per pass, two or three passes: 6.5 to 9.8 s below
Inspector pane, hidden, 1 MB file 362 ms below
TAB in a 5,000-row table 616 ms 2.6
Agenda refresh with 10,000 agenda files 502 ms 2.5

Backlinks. BacklinksPane sits under the outline and both are shown by default (Sources/Orgstar/ContentView.swift:95-97). Its .task(id:) key includes session.editVersion and the heading at the caret (Sources/Orgstar/BacklinksPane.swift:35), so refresh() runs after every 300 ms pause in typing and whenever the caret enters another heading. refresh() is synchronous on the main actor and calls WorkspaceModel.backlinks once for the file and once for the heading (:68, :76); that reads every link in the index and tests each with Backlinks.links (Sources/OrgApp/WorkspaceModel.swift:445-456). In the profile 75 % of the time is the regex literal at Sources/OrgCore/Links/Backlinks.swift:45, which Swift parses again on every evaluation, and 10 % is NSRegularExpression(pattern:) built per call in Links.unescape (Sources/OrgCore/Links/Links.swift:38). The cost is about 33 to 65 µs per link per pass, so a workspace with 5,000 links already blocks for a third of a second after each pause.

Inspector. InspectorPane runs its .task while inspectorShown is false, the default (Sources/Orgstar/InspectorPane.swift:44, Sources/Orgstar/ContentView.swift:284). Each run builds a DocumentModel and a clock report for the whole file on the main actor (:143).

Two more places do index work in a view body or on the main actor without a measurement in the app: the Mac's search results call workspace.search and workspace.overlay inside body (Sources/Orgstar/ContentView.swift:276), as does the iOS search screen (Sources/OrgstarMobile/SearchScreen.swift:26). overlay rebuilds a FileRecord from the buffer's bytes whenever the text changed (Sources/OrgApp/WorkspaceModel.swift:479-488); that is a full parse plus the semantic pass, 212 ms per MB.

2.4 Index

10,000 files, 19 MB, 80,000 headings, on the internal SSD.

First build (Reconciler.reconcile(root:)) 11.8 s, one thread
Memory during the build +249 MB
Index size 62 MB, 3.3 times the text
Reconcile with nothing changed 0.99 s, of which the directory scan is 0.97 s
Reconcile one changed path 20.5 ms, of which fileStates(root:) is 13.4 ms
index.files() 4.7 ms
Search, one to three terms 11 to 55 ms
links() / nodes() / outline(maxLevel: 3) / tags() 147 / 116 / 151 / 12 ms

The build reads every file, keeps the bytes and the finished record of each in memory (Sources/OrgWorkspace/Reconciler.swift:69-130), and writes them in one transaction (Sources/OrgIndex/IndexStore.swift:201-218). The store is a DatabaseQueue with the default journal mode (:76-80; PRAGMA journal_mode returns delete), so every reader waits for that transaction, including reloadFiles() and search on the main actor.

A whole-root scan runs at launch, when file events are dropped, and after trashing or renaming a file (WorkspaceModel.rescan(containing:), Sources/OrgApp/WorkspaceModel.swift:430-435). It costs about 97 µs per file with nothing changed.

Of the 62 MB, 18.4 MB is the FTS content table (a second copy of every heading's text) and 13.7 MB the FTS index. The properties, timestamps and clocks tables and the rows of tags with inherited = 1 are written for every heading (IndexStore.swift:248-266) and no query reads them; the same holds for the todo, is_done, priority, archived and parent_ordinal columns of headings. In this corpus they are 5.4 MB with their indexes. The agenda does not use the index at all; it parses files itself.

The agenda keeps an AgendaSource per file, parsed from the file's text, in an AgendaSourceCache (Sources/OrgApp/AgendaModel.swift:10-16).

10,000 files
Building the sources, cold (read and parse) 7.5 s, one thread
Heap held by one cache 176 MB, 9 times the text
attributesOfItem for every file 502 ms
Day / week / month, 23 to 108 dated entries 27 / 188 / 796 ms
Day / week / month, three dated entries per file (30,725 items today) 12.1 / 13.0 / 16.9 s
The same three views over 1,000 of those files 174 / 266 / 630 ms
TODO list / text search / tag match 447 / 387 / 149 ms

Each refresh stats every agenda file on the main actor before it hands the parsing to a detached task (AgendaModel.swift:187-202, the attributesOfItem call at :194). That is a 50 ms block per 1,000 files on every refresh, cache hit or not. Refreshes are frequent: the agenda views, the sidebar, the widgets' snapshot and the reminders each refresh, and on the Mac, with orgstar+ unlocked or the menu bar item on, the widgets' refresh follows every pause in typing with no delay when reminders are off (Sources/Orgstar/ContentView.swift:499-505, :1168-1173, :1188-1190).

Each AgendaModel has its own cache. The Mac creates five (Sources/Orgstar/AgendaView.swift:111, BoardView.swift:33, AgendaSidebar.swift:34, ContentView.swift:1176 and :1191), iOS two that do not share (Sources/OrgstarMobile/MobileModel.swift:84, BoardScreen.swift:28). Each one reads and parses every agenda file and holds the result.

Agenda.list scans every source once per day shown (Sources/OrgCore/Agenda/Agenda.swift:192-199), so a month costs 30 day views. With many items on one day the cost grows faster than the item count (70 times the time for 10 times the files); a real agenda does not have 30,000 items on a day, so this matters less than the per-day scan.

Search Notes is the index search above: 11 to 55 ms at 80,000 headings.

2.6 Tables

TableCommand(.align) on a 5,000-row, three-column table takes 586 ms. tableNextField calls tableAlign() unconditionally (Sources/OrgCore/Commands/Table.swift:289-293), so every TAB in a table realigns all of it: 63 ms at 500 rows, 616 ms at 5,000. Org realigns only when a field changed width.

2.7 Save, external changes, conflicts

Saver.save through CoordinatedFileSystem on the internal SSD: 7 ms median for 1 MB (15 ms worst of five), 35 ms for 10 MB (43 ms). A save reads the file three times, writes it once and reads the backup (Sources/OrgDocument/Saving.swift:58-81, FileStorage.swift:23-45). A coordinated read alone is 0.7 ms for 1 MB.

These run on the main actor: DocumentSession.open (Sources/OrgApp/DocumentSession.swift:253), save (:444), fileChanged (:1083) and the conflict commands. On a local disk that is invisible. On iCloud Drive or a File Provider folder a coordinated read can wait for a download or for another coordinator while the window is blocked. Not measured: this Mac's iCloud Drive holds the owner's notes, and Syncthing was not set up for the review (section 7).

2.8 Export and tangling

100 kB 300 kB 1 MB
HTML 134 ms 379 ms 1.25 s
Markdown 126 ms 356 ms 1.20 s
LaTeX 514 ms 1.50 s
ODT 423 ms 1.22 s
ASCII 1.65 s 12.8 s
ASCII, footnotes removed 1.07 s 7.94 s
Tangle, as the app calls it 19 ms 48 ms 155 ms

HTML, Markdown, LaTeX and ODT are linear over these sizes. ASCII is not: three times the text takes 7.7 times as long. One cause is ASCIIRenderer.definition, which walks the whole tree for each footnote reference (Sources/OrgCore/Export/ASCIIExport.swift:1369-1370); the export is still superlinear without footnotes, from a path not profiled. LaTeX, ASCII and ODT were not timed one by one above 300 kB. At that rate ASCII needs about two and a half minutes for 1 MB, and at 10 MB it was stopped after six minutes.

All the exporters pay for regex literals written inline: OrgCore has 197 of them, none in a static let, and each is parsed again when its line runs (profile: Regex.init(_regexString:version:) under LaTeXRenderer.footnote, Sources/OrgCore/Export/LaTeXExport.swift:1875). Quick Look's preview is HTMLExport.page, so a 1 MB file takes about 1.3 s to preview.

Tangle.run parses the file again for every block when no tree is passed (Sources/OrgCore/Compute/Tangle.swift:61); the app always passes one (Sources/OrgApp/TangleWriter.swift:66, :73), so only other callers would pay: 60 s for 1 MB with 770 blocks.

PDF and Word export go through WebKit and NSAttributedString and were not timed.

2.9 Launch

Mac, release Developer ID build, arm64, warm (the binary and its libraries in the file cache). Time from Process.run() to the first window of at least 200 points appearing in CGWindowListCopyWindowInfo.

First window Footprint a few seconds later
Empty data folder 467 and 565 ms 58 to 63 MB
1,003-file folder, small file selected, nine launches 393 to 446 ms 100 to 145 MB
Same folder, 1 MB file selected 399 to 427 ms 192 to 217 MB

The window appears before the editor has its text; after it come the waits in 2.3. Cold launch (after a restart) could not be taken without sudo purge or a reboot. The first run of a newly built binary took 6.1 s, which is macOS checking the new executable.

2.10 Widgets, the watch app, the Live Activity

Read from the code; timings need devices.

  • Widgets read one JSON snapshot and build a timeline with an entry per change in the day (Sources/OrgstarWidgets/AgendaTimeline.swift:32-47). AgendaSnapshot.write skips the write and the reload when days and colors are unchanged (Sources/OrgApp/AgendaSnapshot.swift:238-243). The design is cheap.
  • While orgstar+ is locked on iOS, updateWidgets calls reloadAllTimelines() every time it runs (Sources/OrgstarMobile/MobileModel.swift:301-306), which is after every edit, with nothing new for the widgets to read.
  • The widget extension links all of OrgApp (section 4), so its process starts with a 10 MB text segment, GRDB, SwiftMath and the rest mapped.
  • The watch app and its complications link only OrgWatchData and are 3 MB in total.
  • iOS has no background modes and no BGTaskScheduler. Indexing, reminders and widget snapshots are refreshed only while the app is in the foreground, so background energy is close to nothing and widgets go stale when files change by sync while the app is closed.

3. Memory and energy

Memory per open file, from the gates: 25 to 51 times the file size on the heap after styling (2.1), 35 times for the mixed 10 MB document, which is 352 MB. The tree alone is 18 times the text. DocumentState also holds the original bytes, the decoded source text and the current text (Sources/OrgDocument/DocumentState.swift:25-27). Two gate limits are exceeded: 50.7x against 45x for the table, 11.6x against 10x for csg.org. A 10 MB file on an iPhone is likely to be ended for memory; needs a device.

Other holders, all scaling with the workspace: 176 MB per agenda cache at 10,000 files, times the number of caches (2.5); 249 MB transient during the first index build (2.4); the iOS Spotlight indexer reads every changed file into one array and submits one batch (Sources/OrgstarMobile/SpotlightIndexer.swift:56-76), so the first index of a workspace holds all its text twice.

Leaks: leaks --atExit on a launch that opens the 1 MB file and quits reports 416 leaks, 26,400 bytes, all in system XPC connections (LNDaemonApplicationInterface) and dispatch sources; none has app code as its owner. Retain cycles over a long session and with several large buffers need Instruments (section 7).

Energy, from the code:

  • The Mac's mode line reads .git/HEAD every 5 seconds for as long as a pane exists, whether or not the app is active (Sources/Orgstar/ModeLine.swift:105-112).
  • Reminders, widgets and Spotlight are recomputed after each edit: on iOS one second after typing stops (Sources/OrgstarMobile/OrgstarMobileApp.swift:155-168), each pass statting every agenda file.
  • The side panes in 2.3 burn main-thread time after each pause.

4. Size

4.1 Bundles

Release builds as the commands in CONTRIBUTING.org produce them. The Xcode builds are universal and unsigned and have not been through an archive, which strips symbols; the __TEXT column is what stripping leaves untouched. The zip is ditto -c -k, a rough stand-in for the download.

Bundle Size Zip Main executable __TEXT, arm64
Mac App Store, Orgstar macOS, arm64 + x86_64 179 MB 60.9 MB 81.3 MB 26.5 MB
Developer ID, scripts/build-app.sh, arm64 only 102 MB 34.9 MB 41.6 MB 27.2 MB
iOS, Orgstar iOS, simulator, arm64 + x86_64 226 MB 96.4 MB 81.5 MB 26.2 MB
Watch app with its widgets, inside the iOS bundle 3.05 MB 0.74 MB 0.11 MB

Per extension, universal binaries, with arm64 __TEXT:

Extension Mac App Store iOS __TEXT, arm64 Links
Widgets 45.4 MB 45.7 MB 9.7 to 9.8 MB OrgApp and everything under it, plus a 7.1 MB copy of SwiftMath's fonts
Share 45.0 MB 9.6 MB the same
Quick Look 16.0 MB 15.9 MB 4.9 MB OrgCore
Spotlight 16.0 MB 4.9 MB OrgCore

The device and App Store download sizes (thinned, compressed by Apple) need an archive and App Store Connect's report (section 7).

The Developer ID binaries are not stripped: neither scripts/build-app.sh nor scripts/release-mac.sh calls strip. strip -x takes the four executables from 77.3 MB to 54.6 MB per architecture (main 41.6 to 30.1, widgets 19.6 to 12.7, Quick Look 8.1 to 5.9, Spotlight 8.1 to 5.9), about 45 MB of a universal DMG's contents.

4.2 Resources

Resource Size Where
Tree-sitter grammars, compiled in about 14.2 MB of object code per architecture: Haskell 3.6, C++ 3.3, Ruby 2.0, Bash 1.3, Rust 1.1, C 0.6, the other twelve with the scanners 2.4 main executable
Highlight queries 0.3 MB 16 small bundles
Diagram and math scripts (OrgMathJax) 8.75 MB: mermaid.min.js 5.29, tex-svg-full.js 2.17, viz-global.js 1.27 both apps
SwiftMath fonts 7.1 MB per copy: 12 math fonts with their tables one copy in the Mac app and one in its widget extension; three copies on iOS (app, widgets, share)
iOS app icons 18.1 MB Assets.car: 13 icon sets at 0.6 to 2.1 MB each iOS app
Mac icon previews 3.07 MB, 26 PNGs Mac app
String catalogs 0.1 MB per language, five languages; 1,151 strings every bundle that has UI
Themes in code
Sparkle 2.76 MB Developer ID only

The grammars are more than half of the main executable's 26.5 MB of __TEXT. Haskell and C++ together are 6.9 MB per architecture. LatexPreview calls MathImage(latex:fontSize:…) without a font (Sources/OrgPresentation/LatexPreview.swift:99), so it uses SwiftMath's default and the other eleven fonts, about 6.3 MB per copy, are never loaded.

4.3 Code linked into extensions that don't need it

The widget sources use AgendaSnapshot, HabitSnapshot, ClockSnapshot, CaptureInbox, ProAccess and three intents; the share extension uses CaptureInbox and its template list. Both declare OrgApp as their dependency (Package.swift, and packageProductDependencies in ios/Orgstar.xcodeproj/project.pbxproj), which brings OrgCore, OrgIndex with GRDB, OrgDocument, OrgPresentation with SwiftMath and its font bundle, and OrgApp's own WebKit, JavaScriptCore, PDFKit, StoreKit, Charts and EventKit code. The watch targets show the alternative: they depend on OrgWatchData, 197 lines, and come to 0.74 MB.

Quick Look needs HTMLExport and Spotlight needs FileSummary. They link the one OrgCore module, 57,321 lines, which also holds the commands, agenda, Calc, Babel, keymaps, the Elisp reader and OpenPGP.

4.4 Build time

Time Notes
swift test, clean checkout 164 s 33 s resolving packages from the local cache, 49 s building, 82 s of tests
swift test, nothing to build 91 s
ORGSTAR_SKIP_ORACLE=1 swift test 30 s 252 tests skipped
swift test --enable-code-coverage 143 s rebuild with instrumentation, then the tests
Release build of all test targets, for the gates about 3.5 min
xcodebuild, Orgstar macOS, clean 251 s Release, arm64 + x86_64
xcodebuild, Orgstar iOS, clean 210 s Release, simulator, arm64 + x86_64, watch app included
scripts/build-app.sh 205 s release, four products, with part of the release build already cached
swift build --build-tests, no change 3.2 s
The same after touching one file in Sources/Orgstar 5.4 s
The same after touching one file in Sources/OrgCore 6.0 s a change to a declaration other modules use rebuilds them all; not measured

Disk: .build is 3.3 GB after a debug swift test, 12 GB after both Xcode builds as well (.build/xcode is 6.0 GB), and 14 GB after the release, coverage and app builds of this review.

5. Code quality

5.1 Module boundaries

Module Lines Imports beyond Foundation
OrgCore 57,321 CryptoKit, CommonCrypto (OpenPGP), ImageIO (ODT image sizes)
OrgDocument 719 OrgCore, CryptoKit
OrgIndex 895 OrgCore, GRDB, CryptoKit
OrgWorkspace 428 OrgCore, OrgIndex, CoreServices (FSEvents, behind #if os(macOS))
OrgPresentation 2,338 OrgCore, SwiftMath, AppKit or UIKit in LatexPreview.swift only
OrgApp 15,390 SwiftUI, Observation, AppKit and UIKit, WebKit, JavaScriptCore, PDFKit, StoreKit, EventKit, Charts, ActivityKit, AppIntents, UserNotifications, LocalAuthentication, SQLite3
OrgEditorAppKit 3,791 AppKit
OrgHighlight 2,526 SwiftTreeSitter and 18 grammars
OrgPrograms 642 OrgApp
OrgWatchData 197 none

The lower modules are clean: eight platform conditionals in all of OrgCore, OrgDocument, OrgIndex, OrgWorkspace and OrgPresentation (Paths.swift:8, Sandbox.swift:11,21,38, LatexPreview.swift:5,81,109, FSEventsWatcher.swift:1), and no process spawning outside OrgPrograms. Nothing platform-specific has leaked downward.

Two boundaries are too coarse. OrgCore is one module for everything that is pure Org, which is why the two smallest extensions link 5 MB of it and why any change to one of its declarations rebuilds everything. OrgApp mixes models, SwiftUI views, StoreKit and the widget data types, which is why the widget and share extensions link all of it (4.3); it has 46 #if blocks.

5.2 Mac and iOS duplication

Identical lines of 40 characters or more, comments and imports left out:

  • iOS app against OrgEditorAppKit: 236 of 3,268. MobileEditor+Modal.swift shares 50 of its 101 lines with Modal.swift, MobileEditor+Latex.swift 19 of 26 with OrgEditor+Latex.swift, MobileEditor+Display.swift 36 of 77 with OrgEditor+Images.swift and OrgEditor+Shrink.swift, MobileEditor+Styling.swift 31 of 113, MobileFragments.swift 29 of 109 with Fragments.swift, MobileTheme.swift 22 of 69 with Theme.swift.
  • iOS app against the Mac app: 311 of 3,268. BoardScreen.swift shares 40 of 81 lines with BoardView.swift, VersionScreens.swift 28 of 41 with VersionViews.swift, CaptureScreen.swift 26 of 140, ProScreen.swift 17 of 50 with StoreViews.swift. FocusFilter.swift exists twice and differs in three lines; CaptureIntent.swift exists twice and differs in how it reaches the models.

The two editors are the costly pair. They are written separately on the same Presentation functions, they have already diverged (the Mac styles in chunks, iOS does not; the Mac guards LaTeX previews with isOrg, iOS does not: OrgEditor+Latex.swift:25, MobileEditor+Latex.swift:25), and only the Mac one has tests. The loop that turns style runs into attribute changes is the part that could live in OrgPresentation for both.

5.3 Dead code

Declarations nothing in Sources/ uses, each checked by search:

  • Days.timeRegex (Sources/OrgCore/Agenda/Days.swift:62)
  • ClockHistory.defaultLength (Sources/OrgCore/Commands/ClockHistory.swift:54)
  • sendItem (Sources/OrgCore/Commands/OrgList.swift:647)
  • resultKeyword (Sources/OrgCore/Compute/BabelResults.swift:299)
  • TableModel.columnCount (Sources/OrgCore/Semantic/TableModel.swift:18)
  • Used by tests only: Habit.insertGraph (Habit.swift:182), Vim.deletedBackward (Vim.swift:177), IndexStore.duplicateIDs (IndexStore.swift:525), Presentation.startupWrapperFolds (Folding.swift:162), AgendaScope (Discovery.swift:145), DocumentState.canUndo and canRedo (DocumentState.swift:51-52).

OrgstarSpike (Sources/OrgstarSpike/main.swift, 89 lines) is the phase 1 throwaway app. It is still a product in Package.swift, so every swift build compiles and links it, and Tests/OrgEditorAppKitTests/TwoViewsSpikeTests.swift keeps its name alive.

Settings: all 134 entries of UserConfig.settings are read somewhere. Commands: every registered command is reachable from the palette, so none is unused in the strict sense; which ones nobody can find is #135 and #138.

The index's unread tables and columns (2.4) are dead data.

5.4 Concurrency

The package builds in the Swift 6 language mode (tools 6.2; the Xcode targets set SWIFT_VERSION = 6.0), so data-race checking is on and there are no concurrency warnings. The escape hatches:

  • 29 @unchecked Sendable types. Most guard their state with a lock (HiddenRanges, FoldedHeadings, TextCache, FolderPresenter, BabelSessions) or are TextKit subclasses that must be marked.
  • 17 nonisolated(unsafe) variables. One is lock-guarded (EmacsBuffer.cache, Sources/OrgCore/Commands/EmacsBuffer.swift:394). The rest are plain mutable statics. Theme.blockBackground, Theme.selection and Theme.focusedLayouts (Sources/OrgEditorAppKit/Theme.swift:73-77) are written on the main actor and, by their own comments, read by layout fragments off it, with no lock; focusedLayouts is a Set. UserConfig.directoryOverride (Sources/OrgApp/UserConfig.swift:12) is reassigned on every config reload on iOS (Sources/OrgstarMobile/MobileModel.swift:127) while detached tasks read config paths. AgendaSnapshot.useGroupContainer, PDFExport.mathJaxURL, DiagramBlocks.vizURL and mermaidURL, EmacsFallback.offered and the TableBlocks and RemoteTables hooks are set once at launch.
  • About 85 unstructured Task { } in the app targets and OrgApp (25 in Orgstar, 41 in OrgstarMobile, 17 in OrgApp) and 12 Task.detached. Most belong to a view's .task or are stored and cancelled (autosave, outlineUpdates, refreshing). The Mac's CaptureIntent polls for its environment 50 times at 100 ms (Sources/Orgstar/CaptureIntent.swift:30).

WorkspaceRoot.resolve() calls startAccessingSecurityScopedResource() and nothing calls the matching stop (Sources/OrgWorkspace/Discovery.swift:22). It runs for every root at launch and on every add, remove and re-grant, and from savedRootPaths (Sources/OrgApp/WorkspaceModel.swift:86, :115, :140), so each call leaks one sandbox extension until the app quits.

5.5 Error handling on paths that touch user files

try? appears 438 times in Sources/ (170 in OrgApp, 132 in OrgCore, 56 in OrgstarMobile, 38 in Orgstar). try! appears 148 times, all but seven on regex patterns; the seven are preset keymaps, two backToHeading() calls after a check, a JSON encode of a string, and undo and redo (DocumentState.swift:74, :80). The document save path itself is strict: Saver and CoordinatedFileSystem throw, and DocumentSession reports through lastError.

The exceptions that can lose or hide something:

  1. Shared captures on iOS. CaptureInbox.take() deletes each .link file as it reads it, whether or not the read worked (Sources/OrgApp/CaptureInbox.swift:40-47), and the app keeps what it read in a @State queue shown one capture sheet at a time (Sources/OrgstarMobile/OrgstarMobileApp.swift:373-381). Captures still in the queue when the app is ended are gone. AttachmentInbox does it the right way: the batch stays until remove.
  2. Configuration files read as empty and written back. MobileModel.set reads config.toml with (try? String(contentsOf:)) ?? "" inside the coordinated write and writes the result (Sources/OrgstarMobile/MobileModel.swift:189-190); a file that exists but cannot be read (not UTF-8, not downloaded, permission) is replaced by one holding the single setting. The same pattern is in AgendaViews.save for views.toml (Sources/OrgApp/AgendaViews.swift:254) and in the Emacs import for capture.toml, views.toml, config.toml and keymap.toml (Sources/OrgApp/EmacsImport.swift:1197, :1210, :1223, :1236, :1270).
  3. Writes whose failure nobody sees: MobileModel.saveConfig (MobileModel.swift:176, which also drops the coordinator's error), ConfigSync (Sources/OrgApp/ConfigSync.swift:57, :63, :169), every write of the Emacs import (EmacsImport.swift:1207, :1220, :1233, :1250, :1282) while its summary still counts the items as imported, the clock report's Save (Sources/Orgstar/ClockViews.swift:262), TrustStore.save (Sources/OrgApp/TrustStore.swift:27) and ClockModel's state file (Sources/OrgApp/ClockModel.swift:76).
  4. Index failures shown as nothing. filesChanged drops reconcile errors (Sources/OrgApp/WorkspaceModel.swift:289, :295, :298) where refreshOnce reports them; search, nodes and backlinks return an empty list on any database error (:447, :460, :464).
  5. DocumentSession.fileChanged returns silently when the changed file cannot be read (Sources/OrgApp/DocumentSession.swift:1086), so the buffer stays on the old text with no message.

Force unwraps: four as! and five fatalError or precondition calls, none on a file path.

5.6 Tests

Line coverage from swift test --enable-code-coverage, merged over the ten test bundles:

Module Lines Covered Tests
OrgCore 52,761 94.6 % 542
OrgApp 12,684 75.2 % 304
OrgEditorAppKit 3,188 77.4 % 118
OrgPresentation 1,771 97.2 % 72
OrgIndex 1,121 95.6 % 14
OrgPrograms 599 85.0 % 31
OrgDocument 565 98.1 % 40
OrgWorkspace 360 91.1 % 17
OrgWatchData 126 92.9 % 3
OrgHighlight 92 executable 100 % 7
Orgstar (Mac app), 8,869 source lines none 0
OrgstarMobile (iOS app), 10,278 source lines none 0
Widgets, share, watch, Quick Look, Spotlight, 1,308 source lines none 0

The gaps in OrgApp are whole files: AttachActions.swift 2 %, RoamGraphView.swift, CryptSheet.swift, EmacsImportSections.swift, EventSheet.swift and DiffView.swift 0 %, ProStore.swift 7 %. The app targets have no test target, which leaves the iOS editor (about 2,150 lines in MobileEditor*.swift and MobileFragments.swift) with none.

The suite is not deterministic. CalcTests.symbolicFunctionsMatchCalc picks a random seed unless ORGSTAR_SEED is set (Tests/OrgCoreTests/CalcTests.swift:451), and four more Calc tests, LineIndexTests and ListItemScanTests use SystemRandomNumberGenerator (CalcTests.swift:272, :297, :314, :402; LineIndexTests.swift:14, :37; ListItemScanTests.swift:11). One of four full runs during this review failed:

abs(vmin([(3 - uinf) ^ (-1)], [0. < (-1 > 2.5)])) (eng 2) p12 seed 13596949266880706848
ours "0", expected "nan"

That is a real difference from Emacs Calc, and it is also a suite that can fail an unrelated merge request.

Emacs. With ORGSTAR_SKIP_ORACLE=1, 252 of 1,148 tests are skipped and the run drops from 91 s to 30 s. Without the variable and without Emacs the oracle tests fail rather than skip, as the October review recorded; that was not tried again here. Skipped silently on a machine that lacks the tool: the Babel tests for ruby, node, gcc and python3, the Denote tests without the denote packages, and two tests that read the developer's own files (Tests/OrgAppTests/EmacsImportTests.swift:385 reads ~/.config/doom/config.el; Tests/OrgCoreTests/LispReaderTests.swift:27 reads ~/.config/emacs/lisp). Ten corpus tests need ORGSTAR_ORACLE_CORPUS and never run by default.

Slow tests: the slowest suite is OrgCoreTests at 55 to 60 s of wall time, nearly all of it waiting on emacs --batch; the slowest single tests are searchMatchesEmacs (55 s), regionFillMatchesEmacs (45 s) and listsSortLikeOrg (42 s). Without the oracle no test takes over 12 s.

Litter: tests create UserDefaults suites named with a fresh UUID and only 13 call sites remove the domain. Each swift test leaves 33 plist files in ~/Library/Preferences. This Mac has 12,396 orgstar-*-<UUID>.plist files there (5,675 orgstar-config-…, 1,177 orgstar-import-…, 1,143 orgstar-theme-… and thirteen more families), and the test.<UUID> and hidden-<UUID> suites that ProAccessTests, WhatsNewTests and AppTests create add to the 1,859 files of those two patterns; together about 17 MB.

5.7 Compiler warnings

swift test prints eight distinct warnings; the Mac App Store build prints the six that are in app sources; the iOS build prints none.

  • Sources/Orgstar/BufferTabs.swift:35, Sidebar.swift:18, :144, :175: ThemeSpec used in a property without importing OrgPresentation.
  • Sources/Orgstar/ColumnViewSheet.swift:178: ?? on a non-optional String.
  • Sources/Orgstar/ContentView.swift:332: weak captures of session, clock and commands that are captured strongly by the enclosing closure.
  • Sources/Orgstar/ContentView.swift:919: attachActions read inside its own getter. The read is in a closure that runs later, so it does not recurse.
  • Tests/OrgAppTests/EmacsImportTests.swift:349: await with nothing asynchronous.
  • Tests/OrgEditorAppKitTests/EditorTests.swift:307: a downcast that does nothing.

appintentsmetadataprocessor also warns that the Quick Look and Spotlight targets have no App Intents, which is correct. Code scanning findings are #109.

6. What holds up

  • Parsing is linear to 10 MB: 85 ms per MB on the synthetic document. October measured 40 and 74 ms per MB on two real files.
  • Typing in files up to 1.5 MB stays under the 16 ms gate (4.5 to 11.5 ms p95).
  • Index queries are fast enough at 10,000 files, and a single changed file costs 20 ms.
  • The save sequence costs 7 ms per MB and reports every failure.
  • The widgets and the watch app read snapshots and do no parsing of their own.
  • Module boundaries below OrgApp hold, as the October review found.
  • Dead code is rare: eleven declarations in 105,000 lines.

7. Needs a device, Instruments, or a setup this review did not have

Test files, 1 MB and 10 MB:

for size in 1000000 10000000; do
  awk -v max=$size 'BEGIN { while (n < max) { s = sprintf("* TODO Project %d :work:\nSCHEDULED: <2026-11-21 Sat>\n** Section\nParagraph with *bold*, /italic/, =code= and a [[https://example.com/%d][link]].\n\n- item one\n- item two [ ]\n\n", i, i); printf "%s", s; n += length(s); i++ } }' > big-$size.org
done

The Orgstar iOS and Orgstar macOS schemes run the Release configuration with ORGSTAR_PERF set, so the app logs to subsystem sh.krz.orgstar, category perf: every measured interval over 16 ms (session.open, session.save, session.fileChanged, editor.restyleAll, editor.restyle, editor.edit, agenda.refresh, agenda.sources, workspace.refresh, widgets.update, reminders.update, spotlight.update) and every main-thread wait of 100 ms or more. Read it in Console.app with the device selected and the filter subsystem:sh.krz.orgstar category:perf.

  1. iPhone and iPad launch, cold and warm. Xcode ▸ Product ▸ Profile on the Orgstar iOS scheme, App Launch template. Cold: restart the device, wait a minute, record. Warm: end the app from the switcher and record again. Read "time to first frame" and, for the first editable frame, the end of the first session.open interval in the signpost track.
  2. iOS editor with large files. Put the two files in a folder the app has, open each, and read session.open took, editor.restyleAll took and main thread blocked for in Console. Type 20 characters in the middle of the 1 MB file and read editor.edit took and editor.restyle took. Expect the 10 MB file to be ended by the watchdog; note whether it is.
  3. iOS memory. With the 1 MB file open three times over (three copies), read the memory gauge in Xcode's debug navigator, then open the 10 MB file and note the footprint or the termination. Product ▸ Profile, Leaks template, for ten minutes of editing, switching files and opening the agenda.
  4. Widgets. Add the Today, Up Next and Habits widgets. Debug ▸ Attach to Process ▸ OrgstarWidgets, edit an entry in the app, and read the extension's memory at the timeline reload. Filter Console for widgets.update took in the app.
  5. Watch app and complications. Run the OrgstarWatch target on a watch, send an agenda from the phone by editing an entry, and read the memory gauge and the time from the edit to the watch's list changing.
  6. Live Activity. Clock in, lock the phone for 30 minutes, and read Settings ▸ Battery for orgstar's share; in Instruments, the Activity Monitor template attached to the widgets extension shows its CPU while the activity runs.
  7. Energy. Product ▸ Profile, Power Profiler (or the energy gauge), for five minutes idle with a folder of a few hundred files, then five minutes of typing. On the Mac, the same with the app in the background, to see the mode line's 5-second timer.
  8. Sync folders. Put a 1 MB file in iCloud Drive and in a Syncthing folder (Möbius Sync on iOS), edit it for a minute with autosave on, change it from a second device, and read session.save took and session.fileChanged took on both platforms. Repeat on the Mac with the file evicted (Remove Download) before opening it.
  9. Mac cold launch. Restart, wait a minute, launch once from the Dock, and read the first main thread blocked lines and the time to the window; or Product ▸ Profile, App Launch, on Orgstar macOS.
  10. Hangs and retain cycles in a long session. Instruments, Hangs and Leaks templates, on the Mac app with the 1,000-file folder: open ten files, split panes, open and close the agenda and the board five times, and check that OrgEditor, DocumentSession.Entry and AgendaModel counts in Allocations return to their starting values.
  11. Download sizes. Archive both schemes (ORGSTAR_PUBLISH=0 scripts/release-ios.sh and scripts/release-macos.sh) and read App Store Connect ▸ TestFlight ▸ build ▸ App File Sizes for the thinned sizes per device.
  12. The M1 Air gate run, issue 2: ORGSTAR_GATES=1 swift test -c release --filter GateTests.

8. Not covered, and why

  • Highlighting and folding as separate timings: the gates include both, and no existing benchmark splits them.
  • PDF, Word and RTF export: they need WebKit and a window server session, and were left for a profile in the app.
  • LaTeX, ASCII and ODT export above 300 kB, and every export at 10 MB: the ASCII export made the runs too long to finish, and the others were not timed apart from it.
  • The 154 to 318 ms waits at every launch: seen in the log, not profiled.
  • The superlinear growth of the day view with tens of thousands of items, and of ASCII export without footnotes: measured, not profiled.
  • Rebuild time after a change to an OrgCore declaration: it needs a source edit, which this review does not make.
  • Anything on iCloud Drive or Syncthing, and everything in section 7.

9. Findings worth fixing

Severity is high (data loss, or seconds of blocked UI in ordinary use), medium (visible cost at sizes people have, or a structural cost paid on every build or download), or low.

  1. High. The editor styles the whole file before the first frame. Open takes 560 ms for 1 MB against a 100 ms gate; all four gate files fail on open (2.1). Sources/OrgEditorAppKit/OrgEditor.swift:125. Fix: remove the whole-file restyle from init and let the chunked styling pick up indented and hideStars, which are known before load runs.
  2. High. The backlinks pane blocks the main thread after every pause in typing. 1.6 to 9.8 s with 49,400 links; about 0.3 s per 5,000 links (2.3). Sources/Orgstar/BacklinksPane.swift:35, :59-77; Sources/OrgApp/WorkspaceModel.swift:445-456; Sources/OrgCore/Links/Backlinks.swift:24, :45; Sources/OrgCore/Links/Links.swift:38. Fix: hoist the two regular expressions into statics, compute off the main actor, and recompute only when the file, the heading or the index changes rather than on each edit.
  3. High. Styling cost grows with the square of the file size. 1.17 s for 1 MB, 129 s for 10 MB, 77 ms per key at 10 MB (2.2). Sources/OrgEditorAppKit/OrgEditor+Styling.swift:19-57 and its iOS copy. Fix: merge paragraph style and role attributes into one ascending pass so run insertions append instead of shifting the tail, and check the result with the gates; for edits inside very large files that still leaves a tail shift per insertion, so decide whether 10 MB is a supported size and, if it is, back the storage with a structure whose insertions are not linear.
  4. High. The iOS editor styles the whole file synchronously at load, and on every edit under 60,000 units. At least the Mac's 1.17 s per MB on the main thread; not measured on a device. Sources/OrgstarMobile/MobileEditor+Styling.swift:12-18, :99-105, :166. Fix: share the Mac editor's watermark and chunked styling, ideally by moving the run-to-attribute loop into OrgPresentation for both.
  5. High. Shared captures on iOS are deleted before they are filed. Sources/OrgApp/CaptureInbox.swift:40-47, Sources/OrgstarMobile/OrgstarMobileApp.swift:373-381. Fix: list the links without removing them and remove each when its capture sheet is saved or discarded, as AttachmentInbox does.
  6. High. Configuration writers replace a file they could not read, and hide failed writes. Sources/OrgstarMobile/MobileModel.swift:176, :189-190; Sources/OrgApp/AgendaViews.swift:254; Sources/OrgApp/EmacsImport.swift:1197-1282; Sources/OrgApp/ConfigSync.swift:57, :63, :169; Sources/Orgstar/ClockViews.swift:262. Fix: treat only "no such file" as empty, stop on any other read error, and report write errors where the action started.
  7. Medium. The performance gates run nowhere. The regression in finding 1 is six weeks old (2.1). Fix: run the gates from the three release scripts and fail the release on a miss; add a 10 MB case and budgets for index build, agenda refresh and backlinks.
  8. Medium. The inspector pane recomputes while hidden. 362 ms on the main thread per pause for a 1 MB file. Sources/Orgstar/InspectorPane.swift:44, :143. Fix: run the task only while inspectorShown, and build the column view and clock report off the main actor.
  9. Medium. TAB in a table realigns the whole table. 63 ms at 500 rows, 616 ms at 5,000 (2.6). Sources/OrgCore/Commands/Table.swift:289-293. Fix: realign only when the field left behind changed width, as org-table-may-need-update does.
  10. Medium. Every agenda refresh stats every agenda file on the main actor. 50 ms per 1,000 files; 502 ms at 10,000 (2.5). Sources/OrgApp/AgendaModel.swift:187-202. Fix: move the stat loop into the detached task and invalidate cache entries from the workspace's file events instead.
  11. Medium. Each agenda model keeps its own parsed copy of every agenda file. Five caches on the Mac, 176 MB and 7.5 s each at 10,000 files (2.5). Sources/Orgstar/AgendaView.swift:111, BoardView.swift:33, AgendaSidebar.swift:34, ContentView.swift:1176, :1191; Sources/OrgstarMobile/BoardScreen.swift:28. Fix: one AgendaSourceCache owned by the workspace and passed to every model.
  12. Medium. Opening, saving and reloading a file do coordinated I/O on the main actor. 7 ms per MB locally; unbounded on a File Provider (2.7). Sources/OrgApp/DocumentSession.swift:253, :444, :1083. Fix: do the read, merge check and replace on a background task and apply the outcome on the main actor.
  13. Medium. An edit in a file with any non-ASCII character costs 3.3 ms per MB in the document model. 33.5 ms at 10 MB (2.2). Sources/OrgDocument/DocumentState.swift:85-105, :178-182. Fix: keep the text in a form with constant-time UTF-16 offsets, or carry UTF-8 offsets in TextEdit so no index conversion is needed.
  14. Medium. The index is built in one transaction on a queue that blocks readers. 11.8 s and 249 MB for 10,000 files, with search and the file list waiting (2.4). Sources/OrgWorkspace/Reconciler.swift:69-130, Sources/OrgIndex/IndexStore.swift:76-80, :201-218. Fix: commit in batches of a few hundred files, open the store as a DatabasePool in WAL mode, and parse files concurrently.
  15. Medium. Search and backlinks rebuild the dirty buffer's index record on the main actor. 212 ms per MB each time the text changed (2.3). Sources/OrgApp/WorkspaceModel.swift:479-488, Sources/Orgstar/ContentView.swift:276, Sources/OrgstarMobile/SearchScreen.swift:26. Fix: build the overlay from the buffer's existing tree off the main actor, and take the search call out of body.
  16. Medium. Memory per open file exceeds two gate limits. 50.7x for the table (limit 45x), 11.6x for csg.org (limit 10x), 352 MB for a 10 MB file (section 3). Fix: the compact tree the performance plan already describes (token text as offsets), and compare against a hash of the saved text instead of keeping a second copy of it.
  17. Medium. The widget and share extensions link all of OrgApp. 45 MB each as built, 9.7 MB of __TEXT per architecture, with a 7.1 MB font bundle (4.1, 4.3). Package.swift, ios/Orgstar.xcodeproj/project.pbxproj. Fix: move the snapshot types, CaptureInbox and the widget intents into a Foundation-only module, as OrgWatchData is, and make it the extensions' only dependency.
  18. Medium. The test suite is not deterministic, and one random case differs from Emacs Calc. Tests/OrgCoreTests/CalcTests.swift:451 and the unseeded generators listed in 5.6; seed 13596949266880706848. Fix: fixed default seeds with a variable for random runs, and fix or refuse abs(vmin([(3 - uinf) ^ (-1)], [0. < (-1 > 2.5)])), where orgstar answers 0 and Calc nan.
  19. Medium. The iOS app has no tests, and its editor duplicates the Mac's. 10,278 lines at 0 % coverage; 236 identical lines between the two editors (5.2, 5.6). Fix: move the styling driver and the modal-key glue into shared modules where the Mac's tests cover them, and merge FocusFilter.swift and CaptureIntent.swift into one file each.
  20. Low. ASCII export is quadratic, and exporters parse their regexes on every use. 1.65 s for 100 kB, 12.8 s for 300 kB (2.8). Sources/OrgCore/Export/ASCIIExport.swift:1369-1370; 197 inline regex literals in OrgCore. Fix: collect footnote definitions once, as the ODT and Markdown exporters do, and move regex literals on hot paths into static let.
  21. Low. The Developer ID binaries ship unstripped. 22.7 MB of 102 MB per architecture (4.1). scripts/build-app.sh. Fix: strip -x each executable before signing and keep the dSYMs with the release.
  22. Low. Eleven of SwiftMath's twelve fonts are never used. 6.3 MB per copy, two copies on the Mac and three on iOS (4.2). Fix: delete the unused fonts from the bundle in scripts/build-app.sh and in a build phase of the Xcode targets; finding 17 removes the extra copies.
  23. Low. The iOS asset catalog is 18 MB of alternate app icons. 13 sets at up to 2.1 MB (4.2). ios/Orgstar/Assets.xcassets. Fix: recompress the artwork or offer fewer icons.
  24. Low. Quick Look and Spotlight link all of OrgCore. 16 MB each, universal (4.1). Fix: split the parser, FileSummary and the HTML exporter from commands, agenda, Calc, Babel and keymaps, which also shortens rebuilds after a change to the upper half.
  25. Low. The index stores data nothing reads. Three tables, the inherited tag rows and five columns; 5.4 MB of 62 MB here (2.4). Sources/OrgIndex/IndexStore.swift:118-146, :248-266. Fix: stop writing them in a migration, or move the agenda onto them.
  26. Low. A whole-root scan costs a second per 10,000 files with nothing changed. It runs at launch and after trashing or renaming (2.4). Sources/OrgWorkspace/Discovery.swift:109-138, Sources/OrgApp/WorkspaceModel.swift:430-435. Fix: reconcile the affected paths after a trash or rename instead of the root, and read sizes and dates in bulk.
  27. Low. A month view scans every source 30 times. 796 ms at 10,000 files with few dated entries (2.5). Sources/OrgCore/Agenda/Agenda.swift:192-199. Fix: collect each source's dated entries once and distribute them over the days.
  28. Low. Index errors are shown as empty results. Sources/OrgApp/WorkspaceModel.swift:289, :295, :298, :447, :460, :464; Sources/OrgApp/DocumentSession.swift:1086. Fix: set lastError as refreshOnce does.
  29. Low. Tests leave preference files behind. 33 per run; 12,396 on this Mac (5.6). Fix: remove each suite's persistent domain when the test ends, in one helper the tests share.
  30. Low. Energy: polling and redundant reloads. Sources/Orgstar/ModeLine.swift:105-112 reads .git/HEAD every 5 s; Sources/OrgstarMobile/MobileModel.swift:301-306 reloads all widget timelines on every update while locked; Sources/Orgstar/ContentView.swift:1168-1173 refreshes the widgets' agenda after every pause when reminders are off. Fix: poll only while the window is key, reload timelines only when the locked state changed, and give the widget refresh the reminders' two-second delay.
  31. Low. The iOS Spotlight indexer holds every changed file in memory. Sources/OrgstarMobile/SpotlightIndexer.swift:56-76. Fix: read and submit in batches of about a hundred files.
  32. Low. Unsynchronised statics read off the main actor, and an unbalanced security scope. Sources/OrgEditorAppKit/Theme.swift:73-77, Sources/OrgApp/UserConfig.swift:12, Sources/OrgWorkspace/Discovery.swift:22. Fix: guard the three Theme statics and directoryOverride with a lock, and keep the URL from the first resolve() instead of starting access again.
  33. Low. Dead code and warnings. The eleven declarations in 5.3, the OrgstarSpike product, and the eight warnings in 5.7. Fix: delete, and add the missing import OrgPresentation.