Skip to content

Measure what the day ribbon's shader actually costs #111

Open

Description

@lumenpearson

Part of #109.

docs/ says it plainly and has said it since #76: «What it costs is unmeasured too — one shader layer and a per-frame clock on a mid-range phone is a frame budget nobody has looked at.»

The ribbon has three depth levels — AGSL shaders on API 33+, gradients on 31–32, a flat fallback below — and RibbonDepthLevelTest proves which level a given API gets. It cannot prove that the chosen level is affordable.

The ladder, cheapest first:

  1. adb shell dumpsys gfxinfo com.lumenpearson.lessons framestats while scrolling the ribbon. Zero setup, 120 frames of nanosecond columns.
  2. A Perfetto trace, read with trace_processor_shell and SQL. Add androidx.tracing:tracing-perfetto and the trace names the composable that recomposed.
  3. Macrobenchmark with FrameTimingMetric for a number that survives a rerun — see the separate issue for the module, and note it needs a non-debuggable build or the numbers are wrong by a multiple.

What would count as an answer: the three depth levels compared on the same device and the same scroll, with frameOverrunMs P90 for each. If the shader level is not affordable on the phones this is for, the honest fix is to lower the API threshold rather than to keep a level nobody can run.

Do not measure this on an emulator alone. The GPU is emulated; the comparison between levels is meaningful, the absolute numbers are not.

Activity

  1. lumenpearson commented on Sep 26, 2026

    @lumenpearson
    OwnerAuthor

    Relative numbers from an emulator (AVD Pixel_10_Pro_XL, API 37 (google_apis_playstore, x86_64, 1344×2992 at 480 dpi), 26–27 September 2026). Twelve flings of Monday's ribbon, read with dumpsys gfxinfo:

    build SHADER p50 NONE p50
    debug 200 ms 250 ms
    release (bd7c816, from the APK workflow) 150 ms 200 ms

    The system Settings app, scrolled the same way on the same emulator, came out at p50 150 ms with 88 % of frames janky, so these numbers are this emulator's floor rather than the ribbon's cost. Within it the shader adds nothing measurable. With no lesson running the ribbon draws one frame in ten seconds, so nothing redraws per frame when idle.

    Left open for a phone, where the absolute numbers mean something.

  2. moved this from Now to Ready in lessonson Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Ready

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions