Skip to content

docs: a performance model for devices we do not have - #160

Merged
with-developer merged 1 commit into
mainfrom
docs/perf-model
Nov 6, 2026
Merged

with-developer merged 1 commit into
mainfrom
docs/perf-model

Conversation

@with-developer

Copy link
Copy Markdown
Owner

Purpose

Say roughly what a decode or an encode costs on devices we cannot measure, without asking for the user's phone each time (#159).

Summary

  • scripts/perf_model.py (standard library only) fits time = fixed + per_pixel x megapixels for decode to planes, decode to RGB and encode on the M3 Max, from the C API runs of release 0.11.0 (2026-10-26 and 2026-10-27), and scales the per-pixel term by memory bandwidth for other chips. --markdown prints the table, --write BENCHMARKS.md fills it between the file's markers.
  • BENCHMARKS.md gains "Estimates for other devices": the table, marked as estimated and kept apart from the measured tables, with its basis, its check and its limits.
  • ARCHITECTURE.md records the choice as D71.

What the numbers say

  • The lines are straight within 0.04 ms at every size. Fixed costs are alike on the two devices (0.2 to 0.5 ms).
  • The iPhone 17's per-pixel cost is 5.2 to 5.6 times the M3 Max's, against a bandwidth ratio of 5.9.
  • Checked against the iPhone 17's own measurements, the model reads 6 to 8 % high for decoding to planes, 7 to 9 % for RGB and 11 to 16 % for encoding, always above. The table says it is no better than 15 %.
  • Paced decoding (60 frames a second) is not modelled; it stays measured (bench: decode latency inside a client's display loop #81).

How to test

python3 -I scripts/perf_model.py            # fit, check, estimates
python3 -I scripts/perf_model.py --markdown # the table

Documentation and a script only: no library code changes, so no benchmark impact.

Refs #159.

Add scripts/perf_model.py, which fits time = fixed + per_pixel x
megapixels on the M3 Max from the C API runs of release 0.11.0 and
scales the per-pixel term by memory bandwidth to estimate other chips.
The iPhone 17, measured the same way, checks it: the model reads 6 to
16 % above its measurements, so the table is no better than 15 %.

- BENCHMARKS.md gains "Estimates for other devices": a table kept apart
  from the measurements and marked as estimated, with its basis, its
  check and its limits. `perf_model.py --write` rewrites the table.
- Paced decoding (the GPU's power states) is not modelled and stays
  measured (#81).
- ARCHITECTURE.md records the choice as D71.

Refs #159.

Claude-Session: https://claude.ai/code/session_019fJGoCTvP5e7n599q3ZQ42
@with-developer
with-developer merged commit d6bc2b2 into main Nov 6, 2026
7 checks passed
@with-developer
with-developer deleted the docs/perf-model branch November 6, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant