Skip to content

bench: a performance model, to estimate decode and encode times on devices we cannot measure #159

Closed

Description

@with-developer

Why

Measuring on a phone needs the user's phone, unattended, with the keychain unlocked. That does not scale, and each release should still say roughly what it costs on other devices.

The numbers already measured on the M3 Max and the iPhone 17 (release 0.11.0, through the C API, same app, same pictures) fit a two-term model: a fixed cost plus a cost per pixel. The iPhone's per-pixel cost is about 5 times the M3 Max's, near their memory bandwidth ratio (400 against 68 GB/s) and far from their GPU core ratio.

What

  • scripts/perf_model.py, standard library only: fits time = fixed + per_pixel x pixels for each way (decode to planes, decode to RGB, encode) on the M3 Max, compares the fit with the iPhone 17's measurements, and prints estimates for other chips from their memory bandwidth.
  • A table in BENCHMARKS.md, kept apart from the measurements and marked as estimated, with the basis and date of every number.
  • What the model cannot give stays measured: the cost of decoding at a stream's pace (the GPU's power states), which is where bench: decode latency inside a client's display loop #81 comes in.

Done when

The script runs from a clean checkout, its fit and its check against the iPhone are printed, and BENCHMARKS.md has the estimated table with its limits stated.

Activity

  1. with-developer commented on Nov 6, 2026

    @with-developer
    OwnerAuthor

    Merged in #160: scripts/perf_model.py, the estimates section of BENCHMARKS.md and decision D71.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfPerformance

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions