Ariver
2026-06-20 1fea9bfc8a7639bb3573a7cf2a449ab55065ab9e
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# Round01 performance PoC runner. This launches an AppKit/CALayer-only overlay
# with 200 simulated window cards and an auto-cycling selected state.
 
set -euo pipefail
 
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
OUTPUT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# shellcheck source=build-output-paths.sh
source "$SCRIPT_DIR/build-output-paths.sh"
SOURCE_ROOT="$OUTPUT_ROOT/C1.source"
APP="$BUILD_CURRENT_APP"
REPORT="$BUILD_REPORT_ROOT/round01-performance-poc-report.json"
 
require_json_value() {
  local key="$1"
  local expected="$2"
  if ! /usr/bin/python3 - "$REPORT" "$key" "$expected" <<'PY'
import json
import sys
 
path, key, expected = sys.argv[1:4]
with open(path, "r", encoding="utf-8") as handle:
    data = json.load(handle)
 
actual = data.get(key)
if expected == "true":
    ok = actual is True
elif expected == "false":
    ok = actual is False
else:
    ok = str(actual) == expected
 
if not ok:
    print(f"{key}: expected {expected}, got {actual}", file=sys.stderr)
    sys.exit(1)
PY
  then
    exit 1
  fi
}
 
require_json_number_at_least() {
  local key="$1"
  local minimum="$2"
  if ! /usr/bin/python3 - "$REPORT" "$key" "$minimum" <<'PY'
import json
import sys
 
path, key, minimum = sys.argv[1:4]
with open(path, "r", encoding="utf-8") as handle:
    data = json.load(handle)
 
actual = data.get(key)
if actual is None or float(actual) < float(minimum):
    print(f"{key}: expected >= {minimum}, got {actual}", file=sys.stderr)
    sys.exit(1)
PY
  then
    exit 1
  fi
}
 
require_json_number_at_most() {
  local key="$1"
  local maximum="$2"
  if ! /usr/bin/python3 - "$REPORT" "$key" "$maximum" <<'PY'
import json
import sys
 
path, key, maximum = sys.argv[1:4]
with open(path, "r", encoding="utf-8") as handle:
    data = json.load(handle)
 
actual = data.get(key)
if actual is None or float(actual) > float(maximum):
    print(f"{key}: expected <= {maximum}, got {actual}", file=sys.stderr)
    sys.exit(1)
PY
  then
    exit 1
  fi
}
 
cd "$SOURCE_ROOT"
swift build >&2
 
"$SCRIPT_DIR/package-app.sh" >&2
 
rm -f "$REPORT"
 
"$APP/Contents/MacOS/Aligner" \
  --round0-skip-permissions \
  --round01-performance-poc \
  --round01-poc-auto-cycle \
  --round01-poc-auto-hide-after="${ALIGNER_ROUND1_POC_HIDE_AFTER:-8.0}" \
  --round01-poc-quit-after="${ALIGNER_ROUND1_POC_QUIT_AFTER:-10.0}" \
  --round01-poc-report="$REPORT"
 
if [[ ! -f "$REPORT" ]]; then
  echo "Round01 performance PoC report was not created: $REPORT" >&2
  exit 1
fi
 
require_json_value cardCount 200
require_json_value appCount 20
require_json_value cardLayerCount 200
require_json_value appLayerCount 20
require_json_value thumbnailLayerCount 200
require_json_value simulatedScreenshotRefillCount 200
require_json_value waterfallScrollable true
require_json_value spotlightVisible true
require_json_value spotlightAlignedWithSelectedCard true
require_json_number_at_least scrollAdjustmentCount 1
require_json_number_at_least scrollOffset 1
require_json_number_at_least firstFrameLatencySampleCount 1
require_json_number_at_most firstFrameLatencyP95Milliseconds 150
require_json_number_at_least keyboardResponseSampleCount 20
require_json_number_at_most keyboardResponseP95Milliseconds 50
require_json_number_at_least hoverResponseSampleCount 20
require_json_number_at_most hoverResponseP95Milliseconds 32
require_json_value performanceGatePassed true
 
cat "$REPORT"
printf '\n'