perf(producer): cache transfer-converted hdr image buffers per render job#384
Open
vanceingalls wants to merge 1 commit intovance/logger-level-gatingfrom
Open
perf(producer): cache transfer-converted hdr image buffers per render job#384vanceingalls wants to merge 1 commit intovance/logger-level-gatingfrom
vanceingalls wants to merge 1 commit intovance/logger-level-gatingfrom
Conversation
This was referenced Apr 21, 2026
Collaborator
Author
38cae8b to
723c98b
Compare
98daa12 to
21c0314
Compare
723c98b to
2f5ecdc
Compare
21c0314 to
5fe390c
Compare
2f5ecdc to
57abd3a
Compare
5fe390c to
42ab080
Compare
57abd3a to
c0d1d4e
Compare
42ab080 to
6d73ff8
Compare
55a41a8 to
349f0f6
Compare
b71cf6f to
3c4754f
Compare
349f0f6 to
cd65ab0
Compare
e49a01f to
a801330
Compare
5409b1a to
c6a8280
Compare
a801330 to
2af81de
Compare
c6a8280 to
2ce89a5
Compare
2af81de to
a3d4984
Compare
2ce89a5 to
b8d319d
Compare
a3d4984 to
b3241ce
Compare
b8d319d to
d222b31
Compare
b3241ce to
8b636ec
Compare
d222b31 to
e72f484
Compare
8b636ec to
6bc1dd6
Compare
e72f484 to
5338173
Compare
6bc1dd6 to
b03a62f
Compare
5338173 to
b99006d
Compare
b03a62f to
31915d0
Compare
b99006d to
644607f
Compare
31915d0 to
90bd43b
Compare
644607f to
0d7dd4c
Compare
90bd43b to
4555013
Compare
0d7dd4c to
50cc3df
Compare
4555013 to
1f61054
Compare
50cc3df to
bd2cbff
Compare
1f61054 to
0b54ff2
Compare
bd2cbff to
732d2d4
Compare
… job Static HDR image layers whose source transfer differs from the render's effective transfer (PQ↔HLG) were re-running `Buffer.from` + `convertTransfer` on every composited frame, even though the converted buffer is identical for the entire job. Added `HdrImageTransferCache` — a per-render-job bounded LRU keyed by `(imageId, targetTransfer)` that converts once and reuses on every subsequent frame, while leaving same-transfer requests as a zero-copy passthrough. Wired into `renderOrchestrator.ts` via `HdrCompositeContext.hdrImageTransferCache`, instantiated once per job and consumed by `blitHdrImageLayer` on both the main composite path and the transition path. Covered by `hdrImageTransferCache.test.ts` (hit/miss, distinct keys per image and per target transfer, LRU eviction + promotion, `maxEntries=0` passthrough, source-buffer immutability for cached entries, invalid options). Made-with: Cursor
0b54ff2 to
0afa982
Compare
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.

Summary
Add
HdrImageTransferCache— a per-render-job bounded LRU keyed by(imageId, targetTransfer)— so static HDR image layers whose source transfer differs from the render's effective transfer (PQ↔HLG) are converted once per job instead of once per composited frame.Why
Chunk 8Bofplans/hdr-followups.md.blitHdrImageLayerwas runningBuffer.from+convertTransferon every composited frame, even though the converted buffer is identical for the entire job. For a multi-second comp at 30 fps this is hundreds of redundant transfer conversions on the hot path.What changed
packages/producer/src/services/hdrImageTransferCache.ts— bounded LRU keyed by(imageId, targetTransfer)that owns the converted HDR rgb48 buffer for static HDR image layers:Buffer.from+convertTransferon first miss, reuse the cached copy on every subsequent frame.renderOrchestrator.tsviaHdrCompositeContext.hdrImageTransferCache, instantiated once per render job, and consumed byblitHdrImageLayeron both the main composite path and the transition path.Test plan
packages/producer/src/services/hdrImageTransferCache.test.ts— 12 tests:maxEntries=0passthroughhdr-regressionfixture (which has cross-transfer image layers) the cache hits 100% after the first frame; for HDR fixtures without cross-transfer images the same-transfer passthrough is a no-op.Stack
Chunk 8B of
plans/hdr-followups.md. Sits on top of Chunk 8C (logger gating) and Chunk 8A (benchmark harness) so the win is measurable.