commit df50f1be14b4037b8d2a6f41fef705d0b463889b
parent e819953379767994f451f1b4a43a7376f67818a3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 29 Oct 2026 18:01:49 -0400
umtool chrome capture: 1.5 workers a core by default (12 on 8 cores)
Measured on Ember's deck, 10,689 distinct frames by the frame list:
8 workers 114 s with the machine 66 % busy, 12 98 s (86 %), 16 92 s,
24 100 s; 12 workers peaked at 3.4 GB PSS. A worker waits on its
browser for much of each frame, so the budget is 1.5 a core, at most
12, within the chrome's 6 GB of the heavy scope. UMTOOL_CHROME_WORKERS
still sets it outright. Docs: the frame list's drift, fixed by the last
commit, and the numbers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/WORKTREES.md b/WORKTREES.md
@@ -309,12 +309,13 @@ its chrome capture, with about 20 % on top:
whole cut, 2420 MB for a 4-entry window, 1880 MB for one clip (a short run's chrome capture
is the larger, below);
- the chrome capture: 400 MB per render at once (`UMTOOL_CHROME_LAYERS`, default 3) + 320 MB
- per worker of the capture pool's budget (a worker per core, at most 12; or
- `UMTOOL_CHROME_WORKERS`): 3760 MB on 8 cores, 6320 at 16;
+ per worker of the capture pool's budget (1.5 a core, at most 12; or
+ `UMTOOL_CHROME_WORKERS`): 5040 MB on 8 cores, 6320 at 16 (measured: 12 workers peaked at
+ 3.4 GB PSS);
- the ladder: 1000 MB.
So a capped 5 GB build joins a whole-cut render only while `MemAvailable − 6020 ≥ 6000`, and
-a window take while `MemAvailable − 3760 ≥ 6000` (on 8 cores); under that it waits for the render, as
+a window take while `MemAvailable − 5040 ≥ 6000` (on 8 cores); under that it waits for the render, as
before. On a 16 GB machine a whole cut and a build together is rare — the 23-segment batch
alone took MemAvailable to about 450 MB here, with the desktop and the live apps running.
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -512,8 +512,8 @@ nothing and ran alone. `report-to-video/render-estimate.mjs` holds the numbers,
is one) capped at the batch size (`REPORT_VIDEO_XFADE_BATCH` / `render.xfadeBatch`, 24),
one under `--no-xfade`, a transition of 0, `--clip-preview` or `--short`. The capture is
400 MB per render at once (`UMTOOL_CHROME_LAYERS`, 3) + 320 MB per worker (the capture
- pool's budget: a worker per core, or `UMTOOL_CHROME_WORKERS`) -- 3760 MB on 8 cores. A whole
- cut declares 6020 MB, a 4-entry window or one clip 3760 MB on 8 cores;
+ pool's budget: 1.5 a core, or `UMTOOL_CHROME_WORKERS`) -- 5040 MB on 8 cores. A whole
+ cut declares 6020 MB, a 4-entry window or one clip 5040 MB on 8 cores;
- **the encode ladder** (`umtool variants`, Deliver's **Make variants**): 1000 MB (it peaked at 0.76 GB).
Measured on the Huck cut (WORKTREES.md, "A render's estimate"): a 23-segment crossfade batch
@@ -1029,10 +1029,20 @@ layer whose new keys are nearly all its frames (over 90 %) renders whole as befo
The layers then CAPTURE SIDE BY SIDE (report-to-video `capture-pool.mjs`): every layer of a build
starts at once, and each asks one pool of renderer workers for its share right before its renderer
runs -- a worker per 120 frames it will capture, the largest first, one left for each layer beside
-it, at most `UMTOOL_CHROME_LAYERS` (3) renders at once. The pool's budget is a worker per core
-(at least 2, at most 12, within 6 GB of the heavy scope's 8 GB cap; `render-estimate.mjs`
-`chromeWorkers`), or `UMTOOL_CHROME_WORKERS`. A capture is latency-bound, not CPU-bound (8 workers
-left the machine ~45 % idle), so the budget is not shared with anything else that runs then.
+it, at most `UMTOOL_CHROME_LAYERS` (3) renders at once. The pool's budget is one and a half
+workers per core (at least 2, at most 12, within 6 GB of the heavy scope's 8 GB cap;
+`render-estimate.mjs` `chromeWorkers`): 12 on 8 cores. `UMTOOL_CHROME_WORKERS` sets it outright.
+A worker spends much of each frame waiting on its browser, so more workers than cores pay: Ember's
+deck (10,689 distinct frames) captured in 114 s at 8 workers (machine 66 % busy), 98 s at 12,
+92 s at 16, 100 s at 24.
+
+The frame-list page (the one capture of only the frames a render needs) seeks the page's own
+timeline at exactly `cutFrame / fps`, the time a whole render seeks, finding the frame's run by
+binary search. It used to nest a tween per run, which drifted: on Ember's deck 13,542 of 47,041
+frames came out unlike the whole render (a marker and its label a pixel over); now 45,959 are
+byte-identical to it and the other 1,082 differ by the renderer's own worker-to-worker noise (at
+most 47 levels on at most 128 pixels; main's own renders at 6 and 7 workers differ in 2.4 % of
+frames the same way).
`--quick` (a recipe's or a take's `quick: true`) is that quick render. A take that exists is skipped unless forced (**make it again if it exists**, `--force`).
**Rebuild** on a card (`--rebuild`) makes it again from its own take.json against the project's
diff --git a/umtool/report-to-video/render-estimate.mjs b/umtool/report-to-video/render-estimate.mjs
@@ -65,11 +65,15 @@ export const XFADE_BATCH = 24;
//
// chrome: CHROME_BASE × layers + CHROME_PER_WORKER × workers
//
-// The budget, absent UMTOOL_CHROME_WORKERS, is the machine's: a worker per
-// core (a capture is a browser rasterising and PNG-encoding; it is CPU-bound,
-// and nothing else runs during it -- the segments are built before it and the
-// encode after), at most CHROME_AUTO_MAX, and no more than the chrome's share
-// of the heavy scope's cap (CHROME_MEMORY_MB) holds. UMTOOL_CHROME_WORKERS
+// The budget, absent UMTOOL_CHROME_WORKERS, is the machine's: one and a half
+// workers per core, at most CHROME_AUTO_MAX, and no more than the chrome's
+// share of the heavy scope's cap (CHROME_MEMORY_MB) holds. Nothing else runs
+// during the capture (the segments are built before it, the encode after),
+// and a worker spends much of each frame waiting on the browser: MEASURED
+// (2026-10-29, 8 cores, Ember's deck, 10,689 distinct frames by the frame
+// list) 6 workers 210 s, 8 114 s (the machine 66 % busy), 12 98 s (86 %),
+// 16 92 s, 24 100 s; 12 workers peaked at 3.4 GB PSS. Whole renders are
+// lighter still (8 workers left it ~45 % idle). UMTOOL_CHROME_WORKERS
// sets it outright (1-16), as it always has; UMTOOL_CHROME_LAYERS sets the
// renders at once (1 is one layer after another, as before).
@@ -99,15 +103,15 @@ export function chromeLayers(env = process.env) {
/**
* The chrome workers a render's capture shares (build-video's capture pool):
- * UMTOOL_CHROME_WORKERS (1-16) when it is set; else a worker per core, at
- * least 2 and at most CHROME_AUTO_MAX, within CHROME_MEMORY_MB beside
+ * UMTOOL_CHROME_WORKERS (1-16) when it is set; else one and a half per core,
+ * at least 2 and at most CHROME_AUTO_MAX, within CHROME_MEMORY_MB beside
* `chromeLayers` renders.
*/
export function chromeWorkers(env = process.env, cores = machineCores()) {
const set = Number(env.UMTOOL_CHROME_WORKERS);
if (set > 0) return Math.max(1, Math.min(16, Math.floor(set)));
const byMemory = Math.floor((CHROME_MEMORY_MB - RENDER_CHROME_BASE_MB * chromeLayers(env)) / RENDER_CHROME_PER_WORKER_MB);
- return Math.max(2, Math.min(CHROME_AUTO_MAX, Number(cores) || 4, byMemory));
+ return Math.max(2, Math.min(CHROME_AUTO_MAX, Math.ceil(1.5 * (Number(cores) || 4)), byMemory));
}
/** The chrome capture's memory (MB): its renders' bases and its workers. */
diff --git a/umtool/report-to-video/render-estimate.test.mjs b/umtool/report-to-video/render-estimate.test.mjs
@@ -51,22 +51,23 @@ const CHROME = chromeEstimateMb({});
test("the estimate: the larger of the widest crossfade pass and the chrome capture", () => {
assert.equal(XFADE_BATCH, XFADE_BATCH_DEFAULT, "build-video's batch size, mirrored");
- // The budget: a worker per core, at least 2, at most CHROME_AUTO_MAX, within the chrome's memory.
- assert.equal(chromeWorkers({}, 8), 8, "an 8-core machine: 8");
+ // The budget: one and a half per core, at least 2, at most CHROME_AUTO_MAX, within the chrome's memory.
+ assert.equal(chromeWorkers({}, 8), 12, "an 8-core machine: 12");
+ assert.equal(chromeWorkers({}, 4), 6);
assert.equal(chromeWorkers({}, 1), 2, "never fewer than 2");
assert.equal(chromeWorkers({}, 64), CHROME_AUTO_MAX, "a big machine: the cap");
assert.ok(chrome(CHROME_AUTO_MAX, CHROME_LAYERS_DEFAULT) <= CHROME_MEMORY_MB, "the cap fits the chrome's memory");
assert.equal(chromeWorkers({ UMTOOL_CHROME_LAYERS: "8" }, 64), Math.floor((CHROME_MEMORY_MB - 8 * RENDER_CHROME_BASE_MB) / RENDER_CHROME_PER_WORKER_MB), "more renders at once: fewer workers fit");
assert.equal(chromeWorkers({ UMTOOL_CHROME_WORKERS: "7" }, 8), 7, "the override wins");
assert.equal(chromeWorkers({ UMTOOL_CHROME_WORKERS: "99" }), 16, "clamped as build-video clamps it");
- assert.equal(chromeWorkers({ UMTOOL_CHROME_WORKERS: "junk" }, 6), 6, "junk: the machine's");
+ assert.equal(chromeWorkers({ UMTOOL_CHROME_WORKERS: "junk" }, 6), 9, "junk: the machine's");
assert.equal(chromeLayers({}), CHROME_LAYERS_DEFAULT);
assert.equal(chromeLayers({ UMTOOL_CHROME_LAYERS: "1" }), 1);
assert.equal(chromeLayers({ UMTOOL_CHROME_LAYERS: "0" }), CHROME_LAYERS_DEFAULT);
// The capture's memory: its renders' bases (never more renders than workers) and its workers.
- assert.equal(chromeEstimateMb({}, 8), chrome(8, 3));
+ assert.equal(chromeEstimateMb({}, 8), chrome(12, 3));
assert.equal(chromeEstimateMb({ UMTOOL_CHROME_WORKERS: "2" }, 8), chrome(2, 2));
- assert.equal(chromeEstimateMb({ UMTOOL_CHROME_LAYERS: "1" }, 8), chrome(8, 1));
+ assert.equal(chromeEstimateMb({ UMTOOL_CHROME_LAYERS: "1" }, 8), chrome(12, 1));
// Segments: a pass opens at most a batch; unknown is a full batch; batch 0 never batches.
assert.equal(openSegments(68), 24);
assert.equal(openSegments(5), 5);
@@ -74,8 +75,8 @@ test("the estimate: the larger of the widest crossfade pass and the chrome captu
assert.equal(openSegments(68, 0), 68);
assert.equal(openSegments(68, 12), 12);
assert.equal(RENDER, encode(24), "unknown segments: a full batch");
- assert.equal(renderEstimateMb("render", {}, { segments: 4, cores: 8 }), Math.max(encode(4), chrome(8, 3)));
- assert.equal(renderEstimateMb("render", {}, { segments: 1, cores: 8 }), Math.max(encode(1), chrome(8, 3)));
+ assert.equal(renderEstimateMb("render", {}, { segments: 4, cores: 8 }), Math.max(encode(4), chrome(12, 3)));
+ assert.equal(renderEstimateMb("render", {}, { segments: 1, cores: 8 }), Math.max(encode(1), chrome(12, 3)));
// Chrome workers dominate a short run once there are enough of them.
assert.equal(renderEstimateMb("render", { UMTOOL_CHROME_WORKERS: "16" }, { segments: 1 }), chrome(16, 3));
assert.ok(chrome(16, 3) > encode(1));
@@ -111,7 +112,7 @@ test("build-video's CLI and a take read the estimate off the manifest they rende
const file = path.join(dir, "video.manifest.json");
fs.writeFileSync(file, JSON.stringify({ timeline: Array(30).fill({ type: "clip" }), render: { xfadeBatch: 10 } }));
assert.equal(await cliEstimateMb(file, {}, {}), Math.max(encode(10), CHROME), "render.xfadeBatch sizes the pass");
- assert.equal(await cliEstimateMb(file, {}, { REPORT_VIDEO_XFADE_BATCH: "16" }), encode(16), "the env's batch wins, as in build-video");
+ assert.equal(await cliEstimateMb(file, {}, { REPORT_VIDEO_XFADE_BATCH: "16" }), Math.max(encode(16), CHROME), "the env's batch wins, as in build-video");
assert.equal(await cliEstimateMb(file, { clipPreview: "c1" }, {}), Math.max(encode(1), CHROME));
assert.equal(await cliEstimateMb(file, { noXfade: true }, {}), Math.max(encode(1), CHROME));
assert.equal(await cliEstimateMb(path.join(dir, "absent.json"), {}, {}), RENDER);