# Scrolling performance `just profile` builds a Release app and uses XCTest to scroll the feed on a paired iPhone. Unlock the phone before the run. Leave the phone untouched while XCTest sends fast swipes down and back through the feed. The app disables its idle timer during this run, with a ten-minute limit. The script reopens the app with normal sleep behavior when the run ends. The device runner uses the `OldFellaScrollProfile` scheme. This scheme uses the normal Release compiler configuration and excludes the unit-test target. ```sh just profile just profile DEVICE_UID 40 ``` For multiple devices, replace `DEVICE_UID` with a UID from `just devices`. The duration sets the approximate time for scrolling after the feed loads. Each cycle sends four swipes down, then four swipes back. XCTest waits for the interface between gestures. This measures repeated swipes rather than continuous finger motion. The default Time Profiler recorder captures CPU samples and delayed frames with the Hitches instrument. The script saves the trace, driver logs, and an `.xcresult` bundle under `.build/profiles`. The recording starts after launch, initial loading, and three setup swipes. Those swipes test the controls and leave room to scroll back without pulling to refresh. The recording includes all processes. Filter results to `OldFella` within the `OldFellaScrollProfile` interval. The script prints the app hitch count, total delay, and worst delay within that interval. It saves a `.summary.json` file and the raw XML exports beside the trace. It rejects incomplete intervals and recordings without frame data. These numbers describe the controlled run. They do not measure the full feed or promise a fixed frame rate. The default run uses the live feed and the account that is already signed in. For a fixed set of 48 posts, use `OLDFELLA_PROFILE_FEED=rich`. This fixture uses local image data and needs no account. Ordinary test runs skip the device profiling driver unless the script explicitly enables it. ```sh OLDFELLA_PROFILE_FEED=rich just profile DEVICE_UID 40 ``` To profile new live posts and pagination, use forward-only scrolling. The driver taps “Load more posts” when the button is visible and enabled. Each tap adds an `OldFellaLoadMorePosts` event to the trace and a count to the driver log. ```sh OLDFELLA_PROFILE_DIRECTION=forward just profile DEVICE_UID 90 ``` XCTest can cause frame delays while it reads the accessibility tree. Use a manual recording to separate that work from normal scrolling. Wait for the recording message, then scroll and tap “Load more posts” yourself. The driver makes no screen queries during the manual interval. Image fades remain enabled. ```sh OLDFELLA_PROFILE_DIRECTION=manual just profile DEVICE_UID 60 ``` Use the same iPhone, feed mode, duration, and thermal conditions when comparing changes. Live posts and media can change between runs. Keep live results separate from fixture results. For a detailed view of SwiftUI updates, set `OLDFELLA_PROFILE_TEMPLATE=SwiftUI`. SwiftUI tracing adds work to the app. Use it to locate repeated updates, then measure frame delays again with the default recorder. `OLDFELLA_PROFILE_TEMPLATE='Animation Hitches'` enables the broader graphics recorder. This recorder can produce much larger traces. ```sh OLDFELLA_PROFILE_TEMPLATE=SwiftUI just profile ``` For a repeatable simulator measurement, run the focused test in Release configuration: ```sh OLDFELLA_TEST_CONFIGURATION=Release just test-agent OldFellaUITests/ScrollPerformanceTests/testImageFeedScrolling OLDFELLA_TEST_CONFIGURATION=Release just test-agent OldFellaUITests/ScrollPerformanceTests/testRichFeedScrolling ``` The test measures six fast swipes through 24 posts with small images. It records scroll duration, CPU use, and memory after the first image loads. Later images load during scrolling. This fixture uses 32 × 32 images and omits avatars and conversation context. Use iPhone traces to measure frame delays with real content. XCTest prints measurements and saves them in its result bundle. The richer fixture contains 48 posts with dates, link facets, share menus, quote cards, reply context, and 1024 × 768 images. It uses predictable data and local image bytes. It omits avatar downloads and animated media. Both benchmarks exclude launch and initial loading from their measurement interval. The focused creation tests detect eager evaluation of offscreen feed rows: ```sh just test-agent OldFellaUITests/ScrollPerformanceTests/testFeedDoesNotBuildEveryRowBeforeScrolling just test-agent OldFellaUITests/ScrollPerformanceTests/testRichFeedDoesNotBuildEveryRowBeforeScrolling ``` For setup and test commands, read [Development](Development.md).