perf(producer): cache transfer-converted hdr image buffers per render job - #384
Merged
Merged
Conversation
This was referenced Apr 21, 2026
Collaborator
Author
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 21, 2026 20:48
38cae8b to
723c98b
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 21, 2026 20:48
98daa12 to
21c0314
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 21, 2026 20:54
723c98b to
2f5ecdc
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 21, 2026 20:54
21c0314 to
5fe390c
Compare
vanceingalls
marked this pull request as ready for review
April 21, 2026 20:57
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 21, 2026 22:37
2f5ecdc to
57abd3a
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 21, 2026 22:37
5fe390c to
42ab080
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 22, 2026 01:16
57abd3a to
c0d1d4e
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 22, 2026 01:16
42ab080 to
6d73ff8
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 01:58
b8d319d to
d222b31
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 01:58
b3241ce to
8b636ec
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 02:59
d222b31 to
e72f484
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 03:00
8b636ec to
6bc1dd6
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 03:22
e72f484 to
5338173
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 03:23
6bc1dd6 to
b03a62f
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 03:44
5338173 to
b99006d
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 03:45
b03a62f to
31915d0
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 04:52
b99006d to
644607f
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 04:53
31915d0 to
90bd43b
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 05:12
644607f to
0d7dd4c
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 05:13
90bd43b to
4555013
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 05:47
0d7dd4c to
50cc3df
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 05:48
4555013 to
1f61054
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 06:07
50cc3df to
bd2cbff
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 06:07
1f61054 to
0b54ff2
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 07:00
bd2cbff to
732d2d4
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
2 times, most recently
from
April 23, 2026 15:33
0afa982 to
282395d
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 15:33
732d2d4 to
217c325
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 16:35
282395d to
ec4315a
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
2 times, most recently
from
April 23, 2026 17:41
eef88c9 to
1ab61c6
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 17:41
ec4315a to
55a76b1
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 18:14
1ab61c6 to
824aca2
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 18:14
55a76b1 to
31e1374
Compare
vanceingalls
force-pushed
the
vance/logger-level-gating
branch
from
April 23, 2026 18:44
824aca2 to
cb757f1
Compare
vanceingalls
force-pushed
the
vance/hdr-image-transfer-cache
branch
from
April 23, 2026 18:45
31e1374 to
226d019
Compare
Merge activity
|
… 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
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.