perf(engine): consolidate cache key + reuse Phase 2 metadata + cleanups#437
Closed
jrusso1020 wants to merge 1 commit intoperf/producer-gated-hwaccel-decodefrom
Closed
perf(engine): consolidate cache key + reuse Phase 2 metadata + cleanups#437jrusso1020 wants to merge 1 commit intoperf/producer-gated-hwaccel-decodefrom
jrusso1020 wants to merge 1 commit intoperf/producer-gated-hwaccel-decodefrom
Conversation
This was referenced Apr 23, 2026
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Apr 23, 2026
Collaborator
Author
|
Closed: cleanups rolled into new PR-C (extraction cache) in the smaller rebuilt stack. See hyperframes-notes/perf-stack-rebuild-plan-2026-04-23.md |
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.

What
Post-stack cleanup based on
/simplifyreview of PRs #430-#435.Why
Three concrete issues two reviewers independently flagged:
probeSourceForCacheKey(statSync) +computeExtractionCacheKey(sha256) ran once for lookup and again formarkCacheEntryComplete. Hot-path waste in the same PR that adds the cache.extractVideoMetadatasolely to populateExtractedFrames.metadata, even though Phase 2 already probed the same input. ~30-100ms of unnecessary process spawn per cache hit, in the path that's supposed to be near-instant."frame_"filename prefix shared between extractor write and cache lookup with no constant — a one-sided rename would silently produce zero cache hits with no test failure.Plus two minor cleanups:
existsSyncprecheck beforemkdirSync({recursive: true})inensureCacheEntryDir— the recursive mkdir is already idempotent.sequentialInjectorUsedboolean was redundant with the injector stats counters — the same signal can be derived fromhits + misses + inFlightCoalesced > 0.How
FRAME_FILENAME_PREFIXconstantExported from
extractionCache.ts. Both the extractor's write pattern (${FRAME_FILENAME_PREFIX}%05d.${format}) and the cache lookup's filter (f.startsWith(FRAME_FILENAME_PREFIX)) now reference it.Phase 2 metadata reuse
Phase 2's color-space probe used to return a 2-field
{colorSpace, durationSeconds}shape. Now it stashes the fullVideoMetadatadirectly onto eachresolvedVideos[i]assourceMetadata. Phase 3's cache-hit branch usessourceMetadatainstead of probing again.This is safe because Phase 3 cache hits can only occur for inputs that did NOT go through HDR or VFR preflight (those mutate
videoPath, which changes the cache key), sosourceMetadatais current for cache hits.Phase 2b VFR detection still re-probes — HDR preflight may have rewritten the file with different
isVFRcharacteristics.Cache key hoist
Computed once at the top of the per-input map callback and reused for both
lookupCacheEntryandmarkCacheEntryComplete. Eliminates one statSync + one sha256 per cache miss.sequentialInjectorUsedremovalWhat was reviewed but skipped
extractVideoFramesRangeparameter sprawl — would be an API-shape change. Out of scope for cleanup.__createFrameDataUriCacheForTestsnaming — works fine.streamingEncoder/chunkEncodertopixelFormatHasAlpha— touches files outside this stack.Test plan
Stack
Final cleanup commit, built on #435.