Fling: the vsync clock, the frame ask, and a report that can say what it measured
Iris, from her phone: "some stuttering when flinging in particular. Harder to notice with my finger directly moving the scroll." Her fling phase was 103fps on a 120Hz screen at p50 6.3ms. Two of the four things found are corrections to the instrument, not the renderer. The swapchain acquire -- `get_current_texture`, which *blocks* until the compositor frees an image -- was inside the span the report called iris's CPU work, so a fling comfortably ahead of the display read as milliseconds of being slow. A frame is now three measured parts (`FrameParts`: build, acquire, submit), per phase as well as per run. And nothing could say a frame was never *produced*: `late` counts frames that cost too much, which a reader does not see, while a frame that never happens leaves the last one up for two refreshes, which is the stutter. `PhaseStats::missed` counts vsyncs nothing was drawn for. It closes on the emulator: 1548 frames + 452 missed over 33.0s at 60Hz is 1980 vsyncs. The other two are the frame loop. `Choreographer.postFrameCallback` schedules for the next vsync after the call, and iris asked at the *end* of the callback -- so any frame whose work ran past the boundary registered too late and got the vsync after, one frame over budget silently costing a second. It is asked for immediately after `tick_animations` now, on both backends. And the fling was advanced on `Instant::now()` rather than the vsync `do_frame` carries: frames are presented on an even cadence whatever clock computes them, so sampling the spline at "whenever the callback ran" moves the content unevenly with no frame late enough to appear in any report -- and a drag never had it, which is the asymmetry Iris described. `PointerClock` is `DeviceClock` and the view keeps one, anchored by whichever of a touch or a frame comes first, so a fling is advanced on the clock its velocity was measured on. `opt-level` for the Android release build goes from "s" to 3. The table in RUST.md picked "s" on bytes alone; over the same warm fling eight times iris's own per-frame work is p90 0.15ms/p99 0.42ms at "s" against p90 0.09ms/p99 0.26ms at 3, for 1.8 MB of arm64 APK. `app-rust/tests/fling_profile.rs` is the rig that established what a fling frame actually costs and is kept for next time (Iris: "please keep the profiling rig around for future use"): only one frame in six lays anything out, and the multi-millisecond spikes are all first-pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ccfda6b8e
commit
42d54eec95
16 files changed
+703
-153
No files matched your search
@@ -90,6 +90,17 @@ layout that follows is also what keeps layout a pure function of the state
|
||||
(Iris, 2026-09-08). The visible consequence, and the thing that catches a
|
||||
test out: **`amt` does not move until the next draw.**
|
||||
|
||||
**Which clock a fling is ticked on.** The vsync the frame callback
|
||||
carries, not `Instant::now()` -- on Android `do_frame`'s
|
||||
`frame_time_nanos`, converted through the view's one `DeviceClock`
|
||||
(`sense.rs`), which also dates every touch sample, so a fling is advanced
|
||||
on the clock its own velocity was measured on. Frames are presented on an
|
||||
even cadence whatever clock they are computed on, so sampling the spline
|
||||
at "whenever the callback got to run" moves the content unevenly between
|
||||
frames that are shown evenly -- a shimmer that no frame-time percentile
|
||||
can see, since no frame was late. Found 2026-09-09; docs/RUST.md's
|
||||
"The fling stutter" has the rest.
|
||||
|
||||
### Why a remainder was not enough
|
||||
|
||||
The `apply_scroll(&mut delta)` this replaced left the part it could not
|
||||
|
||||
Reference in new issue
Block a user