Performance
Design choices that keep the app responsive, and the measurements taken so far. No figure here was taken on an iPhone or an iPad.
Design
| Concern | Approach |
|---|---|
| Main thread | The app target is main-actor isolated; engines are Sendable types and an actor. Rendering, recognition and export run off the main thread |
| Recognition | One page at a time on a utility queue, progress reported per page, cancellable through the Vision request |
| Editing | Sliders render a bounded preview (1 800 px) with a short debounce; the full-resolution render happens only on export |
| Thumbnails | JPEG previews cached on disk per edit recipe, decoded images in an NSCache with a cost limit, cleared on memory warnings |
| Export | Pages are pulled one at a time into the PDF; temporaries are released per page |
| Background estimate for shadow removal | Computed at about 420 px and scaled up |
| Storage | One atomic manifest write per change; originals are never rewritten |
| Background | beginBackgroundTask around recognition and workflow runs |
Measurements (2026-11-20)
Host: Apple M5 Max, 18 cores, 48 GB, macOS 27.0, swift test -c release. The machine was running other builds and
simulators; two runs a minute apart differed by up to a factor of two on batch figures. Treat these as order of magnitude.
| Measurement | Run 1 | Run 2 |
|---|---|---|
| OCR, A4 at 200 dpi, Accurate (median of 5) | 0.137 s | 0.259 s |
| OCR, A4 at 300 dpi, Accurate | 0.126 s | 0.228 s |
| OCR, A4 at 200 dpi, Fast | 0.088 s | 0.127 s |
| OCR, A4 at 300 dpi, Fast | 0.091 s | 0.115 s |
| Render 12 MP + JPEG, Original | 0.025 s | 0.032 s |
| Render 12 MP + JPEG, Colour | 0.032 s | 0.081 s |
| Render 12 MP + JPEG, Greyscale | 0.033 s | 0.094 s |
| Render 12 MP + JPEG, Black & White | 0.036 s | 0.093 s |
| Preview 1 800 px, Colour | 0.031 s | 0.060 s |
| Recognize 25 pages (A4, 300 dpi, Accurate) | 2.79 s | 5.33 s |
| Export 25 pages, Maximum | 2.19 s | 2.74 s |
| Export 25 pages, Balanced | 1.50 s | 2.00 s |
| Export 25 pages, Small | 1.17 s | 1.30 s |
| Export text, 25 pages | 0.01 s | 0.013 s |
Run 2 is the content of benchmarks/timings.json. Run 1's values were read from the same file
before it was overwritten.
| Size of the 25-page export | Bytes |
|---|---|
| Stored document (originals) | 9 188 126 |
| Maximum Quality | 9 029 483 |
| Balanced | 3 135 694 |
| Small File Size | 1 484 714 |
Memory
The process footprint was sampled before the 25-page batch, after recognition and after the three exports. It did not grow (the footprint was lower at the end than at the start, because earlier test allocations were being returned). Peak footprint during a page was not sampled. An earlier version of the benchmark reported a growth of about 500 MB; that figure included the test's own 25 uncompressed fixture images and was discarded. Per-page autorelease pools were added to the recognition and export loops at the same time.
Launch
XCTApplicationLaunchMetric(waitUntilResponsive: true), five cold launches, empty library, Debug build, Simulator.
| Device | Quiet run | Run under load |
|---|---|---|
| iPhone 17 Pro simulator | 1.13 s average (1.08–1.17 s) | 1.41 s average (1.12–1.60 s) |
| iPad Pro 13-inch (M5) simulator | 1.19 s average (1.14–1.23 s) | 1.74–1.87 s for four launches, one at 19.07 s |
The 19 s launch happened while package tests and another simulator were starting on the same Mac. It was not reproduced, and it was not investigated further.
Not measured
- Anything on a physical device: launch, recognition time per page, memory under the iOS limit, thermal behaviour.
- Camera-to-preview latency.
- Documents larger than 25 pages.
- Energy use.