Repository navigation
perf(gpui): cut capped recording scans by 80% in large libraries - #2532
Merged
richiemcilroy merged 1 commit intoOct 14, 2026
Merged
Conversation
Contributor
|
@AksharP5 is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening GPUI's recording library reads every recording's metadata before keeping just 20 items. Recents does the same work for 9 items. Older recordings therefore add JSON parsing, upload-state reads and thumbnail checks to each capped scan.
Sort the directory candidates first, then load valid recording items lazily until the view is filled. Missing/corrupt metadata still gets skipped, and full Settings/recovery scans still exhaust the same iterator. Screenshot scanning is unchanged.
Native GPUI release benchmark on Linux/i5-14400F, with 25/1,000/5,000 synthetic metadata bundles (75% four-segment Studio, 25% Instant). This measures the production recording scan, not UI rendering or image decoding. Both algorithms are compiled in the same binary; the eager reference is the original implementation from 3d19c5c. Three alternating paired runs per condition, 3 warmups and 15 samples per run, warm filesystem cache, no builds running. Values are the median of the three run medians.
For 1,000 recordings, a separate untimed libc-open counter verified 1,000 metadata reads per eager scan versus 9 or 20 per capped scan. The benchmark asserts equal returned fields and order against the eager reference. Directory enumeration/stat/sorting still scale with library size; the full-list control remains essentially unchanged.
Validation: 18 library tests pass in both debug and release, including invalid metadata, ordering, mixed screenshot merging, recording statuses, recovery filtering and thumbnail revisions.
cargo fmt, scopedcargo check, and the full Linux GPUI binary build pass. Strict Clippy on local Rust 1.99 is blocked by existing code: restoring the exact base reproduced all 17 distinct app/test diagnostics (27 occurrences), with none in either changed file. No lint suppression or unrelated source fixes are included.To reproduce with an explicit recording-library directory (read-only), run both
eagerandboundedmodes, changing the limit to 9, 20 or the corpus size:CAP_GPUI_LIBRARY_BENCH_DIR=/absolute/path/to/recordings \ CAP_GPUI_LIBRARY_BENCH_MODE=bounded \ CAP_GPUI_LIBRARY_BENCH_LIMIT=9 \ cargo test --manifest-path apps/desktop-gpui/Cargo.toml --release --locked \ --bin cap-gpui library::tests::recording_scan_benchmark \ -- --exact --ignored --nocapture --test-threads=1Synthetic fixture used for the measurements
This creates a new temporary library; its recordings have valid metadata but no video or thumbnails because the scan does not read video payloads.
Public overlap check: 243 open PRs, 213 issues and relevant completed library work checked immediately before publication; nearby library PRs change worker cancellation or reveal behavior, not bounded metadata loading.

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
The PR sorts recording folders first, then reads metadata only until capped views are filled.
Reviews (1) · Last reviewed commit: "perf(gpui): cut capped recording scans b..." · Reviewed by Greptile