Skip to content

perf(generator): generate chrome, decoys, and 404 concurrently#5

Open
JoshuaBearup wants to merge 1 commit into
orlyjamie:mainfrom
JoshuaBearup:perf/parallel-asset-generation
Open

perf(generator): generate chrome, decoys, and 404 concurrently#5
JoshuaBearup wants to merge 1 commit into
orlyjamie:mainfrom
JoshuaBearup:perf/parallel-asset-generation

Conversation

@JoshuaBearup

Copy link
Copy Markdown

What

Generate the chrome shell, the decoy pages, and the 404 page concurrently instead of one after another.

Why

In generator/deploy.mjs these three steps ran serially ([3/5] chrome, [4/5] decoys, [5/5] 404). But each depends only on theme and scenario — both already resolved before this stage — and none depends on the others. Decoys were already internally parallel; chrome and 404 were not. Running them serially adds two extra LLM round-trips of latency per deploy for no reason.

How

Wrap the three in a single Promise.all. The stage's wall-clock drops from chrome + decoys + 404 to max(chrome, decoys, 404).

Behaviour is unchanged:

  • Chrome's ensureChromeInjection + {BODY} fail-fast assertion still run, just after the parallel generation resolves.
  • Per-decoy failures are still caught individually and fall back to placeholder content.
  • A chrome or 404 generation failure is still fatal, exactly as before (it now surfaces as a Promise.all rejection).

Testing

node -c clean; confirmed chrome, decoys, and fallback404 are still produced and consumed by the manifest unchanged. I couldn't run a full deploy end-to-end (no ANTHROPIC_API_KEY in my environment), but this is a control-flow reorder of independent steps with no change to the calls themselves.

Chrome, the decoy pages, and the 404 page each depend only on (theme,
scenario) — both ready before this stage — and not on each other, but
they were generated serially (chrome, then decoys, then 404). Run all
three in a single Promise.all so the stage's wall-clock drops from
chrome + decoys + 404 to max(chrome, decoys, 404).

No behaviour change: the chrome {BODY}/chromeInjection post-processing
and fail-fast assertion still run after generation, per-decoy failures
are still caught individually, and a chrome or 404 failure is still
fatal exactly as before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant