Skip to content

perf(desktop): compare Half and Full editor preview - #4488

Open
kyzer1023 wants to merge 3 commits into
CapSoftware:mainfrom
kyzer1023:perf/preview-quality-benchmark-windows-linux
Open

kyzer1023 wants to merge 3 commits into
CapSoftware:mainfrom
kyzer1023:perf/preview-quality-benchmark-windows-linux

Conversation

@kyzer1023

@kyzer1023 kyzer1023 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

Editor preview is Full on Apple Silicon and Half on every other machine until Full is measured there (#4392). This adds the reproducible Half vs Full benchmark and reports measurements across three real GPUs and software rendering. The platform default stays Half.

What changed

cargo run --release -- --preview-compare <project.cap> from apps/desktop-gpui plays the same project at half and full across alternating repeats (default 5). It prints the adapter, playback frames per second, playback and pause p95 frame latency, painted size, range overlap, and default_unchanged. The quality change stays in memory.

Scope

The editor latency bench, the in-memory preview quality setter, and one argument parse in apps/desktop-gpui/src/main.rs. EditorPreviewQuality::for_this_machine is unchanged.

Tradeoffs

Playback frame latency is the p95 from the render callback to paint over seconds 1 to 10 of a 10 s play. Decode cost shows up as presented frame rate and skipped source frames. Pause latency is the wait until a painted frame covers the canvas.

Blast Radius

The sweep does not call set_editor_preview_quality. A unit test verifies the store file is unchanged, and every release run confirmed default_unchanged=true with no editorPreviewQuality key written. Any future default change stays a single condition in for_this_machine.

Verification

Release builds, 5 alternating repeats, synthetic 1920x1080 15 s H.264 project (resolution_changed=true, default_unchanged=true, errors=0, Half 1248x702 vs Full 1920x1080). 22 unit tests passed.

  • Windows AMD Radeon 780M (Dx12 hardware): Half median 59.9 fps (range 31.0..60.0), playback p95 11.97 ms; Full median 60.0 fps (range 57.3..60.0), playback p95 17.06 ms. Both hit the 60 Hz display cap (overlap=true).
  • Linux NVIDIA GeForce MX150 (Vulkan discrete, 2 runs): Run 1 Half 46.0 fps (38.8..59.8, p95 14.04 ms) vs Full 59.0 fps (56.3..59.8, p95 22.12 ms); Run 2 (PRIME offload) Half 58.2 fps (43.3..59.9, p95 15.79 ms) vs Full 56.1 fps (49.9..59.7, p95 20.97 ms). Ranges overlap; Full adds 5 to 8 ms p95 latency at ~56 to 59 fps.
  • Linux Intel UHD Graphics 620 (Vulkan integrated): Half 1.0 fps (0.9..1.0, p95 956.77 ms, pause p95 29.93 ms) vs Full 1.0 fps (0.8..1.0, p95 1887.28 ms, pause p95 1004.49 ms). Both hit a ~1 Hz present bottleneck (present_interval_p95 1003 to 1022 ms, rendered ~59.9 fps); ranges overlap.
  • Linux lavapipe (Vulkan software): Half 23.1 fps (22.0..23.6, p95 33.23 ms) vs Full 18.4 fps (18.1..19.3, p95 47.80 ms). Ranges are disjoint.

Takeaway: Full keeps ~56 to 60 fps on Radeon 780M and MX150, but regresses on software rendering and hits higher p95 latency alongside a 1 Hz present bottleneck on Intel UHD 620, so keeping the default Half off Apple Silicon is warranted until more adapters are measured. Windows NVIDIA/Intel GPUs were not tested.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; both previous findings are fixed and no new blocking issue remains.

Summary

Adds an opt-in Half versus Full preview benchmark without changing the platform default.

  • Desktop operators can compare preview quality across repeated runs.

Reviews (3) · Last reviewed commit: "fix(desktop): compile the preview measur..." · Reviewed by Greptile

Add one command that measures playback frame rate and frame latency
at two preview qualities on the same project. It does not write the
saved quality and does not change the platform default.
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@kyzer1023 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

@kyzer1023

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment on lines +1191 to +1192
for pair in summaries.windows(2) {
match ranges_overlap(metric(&pair[0]), metric(&pair[1])) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Range comparison skips pairs

metric_overlap checks only neighboring qualities. With --preview-compare-qualities quarter,half,full, ranges of 50..60, 20..30, and 55..65 produce false, even though the first and third overlap. This can mislead anyone comparing three qualities. Check every distinct pair before reporting that the ranges do not overlap.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_latency_bench.rs
Line: 1191-1192

Comment:
**Range comparison skips pairs**

`metric_overlap` checks only neighboring qualities. With `--preview-compare-qualities quarter,half,full`, ranges of 50..60, 20..30, and 55..65 produce `false`, even though the first and third overlap. This can mislead anyone comparing three qualities. Check every distinct pair before reporting that the ranges do not overlap.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1f42c2c. metric_overlap now checks every distinct quality pair (i < j) instead of only adjacent pairs, with a unit test (non_adjacent_qualities_still_count_as_overlapping) covering the non-adjacent overlap case.

Comment thread apps/desktop-gpui/src/editor_latency.rs Outdated
Stage::Rendered,
frame,
0,
painted - Duration::from_millis(8),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests use forbidden time subtraction

The new steady_playback helper subtracts Duration values directly from an Instant, here and at line 608. The repository instructions forbid unchecked time subtraction, including in tests. Use checked_sub(...).expect(...) for these known fixture offsets. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_latency.rs
Line: 602

Comment:
**Tests use forbidden time subtraction**

The new `steady_playback` helper subtracts `Duration` values directly from an `Instant`, here and at line 608. The repository instructions forbid unchecked time subtraction, including in tests. Use `checked_sub(...).expect(...)` for these known fixture offsets. This repository requirement must be satisfied before merging.

**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1f42c2c. Replaced unchecked Instant - Duration subtraction in steady_playback with checked_sub(...).expect(...) and verified no other unchecked time subtraction remains in the diff.

Range overlap now checks every quality pair, so a non-adjacent
overlap is reported. Playback fixtures subtract known offsets with
checked_sub.
@kyzer1023

Copy link
Copy Markdown
Contributor Author

@greptileai

kyzer1023 added a commit to kyzer1023/Cap that referenced this pull request Nov 23, 2026
The test uses the Linux editor window fixture, so it is gated the
same way as the other editor window tests.
@kyzer1023

Copy link
Copy Markdown
Contributor Author

@greptileai

kyzer1023 added a commit to kyzer1023/Cap that referenced this pull request Nov 23, 2026

This branch has not been deployed

No deployments
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