Repository navigation
perf(rendering): keep an idle AVAssetReader reader for 5 s unless another track needs its permit - #2986
Merged
Conversation
…ther track needs its permit
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
@greptileai review |
richiemcilroy
marked this pull request as ready for review
October 23, 2026 18:56
This branch was successfully deployed
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.
An idle
AVAssetReaderDecoderthrows away its native reader, decoded-frame cache and warm-ahead frames 250 ms after its last request. In the paused editor, almost any pause between hovers or scrub steps is longer than that. The next request then pays for a new reader (4 to 7 ms on the CI VM) and decodes again from a keyframe. In one traced example, a single hover frame after a teardown decoded 61 frames in 65 ms. Pressing Play after a pause also reopens the reader.Measured on the GPUI editor playback profile (1080p30 fixture, Blacksmith macOS 26 VM): 6 to 6.5 teardowns per 10 s of paused hover, and 9 to 10 in the scrub hunt.
This PR keeps the 250 ms wake-up, but on each wake-up the reader is now released only when:
Behaviour is otherwise unchanged. A request always resets the idle clock, and a released reader is recreated on the next request exactly as before.
Memory: an idle editor holds the frame cache for up to 5 s longer before releasing it, so steady idle memory is unchanged.
Measurements
A/B on
ci/editor-playback-ab-idle(run 39955105504): base and head built in one job, 3 interleaved rounds, mean of 3. The fixture is a 40 s 1080p30 studio project, display only and display plus a 720p camera, on a Blacksmith macOS 26 VM.The "scrub hunt" phase scrubs with 400 ms pauses, like someone looking for a moment:
The other phases:
Memory was not measured by this harness. The frame cache is the same bounded cache as before; it is now released 5 s after the last request instead of 250 ms, so a paused editor's steady memory is unchanged.


Confidence Score: 5/5
The PR appears safe to merge.Summary
Keeps idle
AVAssetReaderDecoderreaders and cached frames warm for roughly five seconds.Reviews (2) · Last reviewed commit: "Merge main into perf/avassetreader-idle-..." · Reviewed by Greptile