summaryrefslogtreecommitdiff
path: root/docs/perf/2026-02-18-baseline.md
blob: bdea2d2ca5bef532bf8326a6d72004cb8d9af08f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# 2026-02-18 Baseline Metrics

## Scope
- Task 1 baseline for performance/redundancy plan.
- Added `SoraTests` harness and failing baseline assertions.

## Commands Run

### Project generation
```bash
just generate
```
Result: success (`Sora.xcodeproj` regenerated with `SoraTests` target).

### Baseline tests via app scheme
```bash
xcodebuild -project Sora.xcodeproj -scheme Sora -destination 'platform=iOS Simulator,name=iPhone 17 Pro' test
```
Result: failed before executing assertions because the simulator failed to initialise the test bundle host in the app scheme.

### Baseline tests via test scheme (expected fail)
```bash
xcodebuild -project Sora.xcodeproj -scheme SoraTests -destination 'platform=iOS Simulator,name=iPhone 17 Pro' test
```
Result: failed as expected baseline, with 4 failures in 3 tests.

Failure highlights:
- `SettingsManagerSyncTests.testBatchedSyncPathGuardsUnchangedPayloadWrites`
  - `XCTAssertGreaterThanOrEqual failed: ("0") is less than ("4")`
- `ViewDerivedDataTests.testGenericListViewDerivedCollectionsAreReferencedOncePerRenderPass`
  - `filteredItems` references: `3 > 1`
  - `sortedFilteredItems` references: `3 > 1`
- `ViewDerivedDataTests.testPostGridViewDerivedCollectionsAreReferencedOncePerRenderPass`
  - `activePosts` references: `6 > 1`

### Format + lint
```bash
just format && just lint
```
Result: success.

### Debug simulator build
```bash
just build_ios_simulator Debug
```
Result: success.

## Timing Snapshots

### Test run (SoraTests scheme)
Command:
```bash
/usr/bin/time -p sh -c "xcodebuild -project Sora.xcodeproj -scheme SoraTests -destination 'platform=iOS Simulator,name=iPhone 17 Pro' test > /tmp/sora_task1_test.log 2>&1"
```
Timing:
- real: `22.36s`
- user: `3.81s`
- sys: `2.91s`

### Format + lint
Command:
```bash
/usr/bin/time -p sh -c "just format && just lint"
```
Timing:
- real: `0.51s`
- user: `0.54s`
- sys: `0.11s`

### Simulator debug build
Command:
```bash
/usr/bin/time -p just build_ios_simulator Debug
```
Timing:
- real: `4.04s`
- user: `2.73s`
- sys: `1.43s`

## Hotspot Files (Baseline)
- `Sora/Data/Settings/SettingsManager.swift`
  - `triggerSyncIfNeeded(for:)` performs 4 `NSUbiquitousKeyValueStore.default.set(encoded, ...)` writes with no `!= encoded` unchanged guard in that batched sync path.
- `Sora/Views/Generic/GenericListView.swift`
  - Repeated derived-data references in render path:
    - `filteredItems`: 3 references
    - `sortedFilteredItems`: 3 references
- `Sora/Views/Post/Grid/PostGridView.swift`
  - `activePosts` referenced 6 times in the view/render path.

## Notes
- Existing warning observed during build/test:
  - `Sora.xcodeproj`: Copy Bundle Resources includes `Sora/Resources/Info.generated.plist`.
- Follow-up metrics and final verification are recorded in `docs/perf/2026-02-18-after.md`.