mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-14 19:27:01 -04:00
A batch ran its photos strictly one after another: each render is row-parallel inside, but a photo's decode, its PNG/TIFF/WebP encode and the wait on a GPU render are mostly serial, so a 32-core machine averaged ~9.5 busy cores on the CPU path and 1-2 with the GPU. run_batch now keeps export_parallelism() photos in flight (cores / 4, 1..=4; one on wasm32) on scoped lane threads plus the calling thread. Each holds an estimate of its working memory from a new export_gate (twice the memory budget, separate from the decode gate it nests over), so full-size 24 MP exports (~1.2 GB each) run two at a time by default. Lanes run at most `lanes` photos past the last one placed, which also bounds the finished files waiting for their turn. Paths, conflict handling, original protection, writes, results and progress stay in batch order (Placer), so the files are the same as one at a time; a panic in a lane becomes that photo's error. render_bench's batch scenario now goes through export_batch. 8 x 24 MP JPEGs, 32 cores + RTX 4080 Laptop: CPU 3.87 s -> 2.35 s, GPU 4.21 s -> 1.82 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>