Expand description
Process-parallel page rendering for pass B of the post pipeline
(docs/performance/STREAMING_POST_DESIGN_2026-07-06.md §6).
In-process page threads are blocked twice (ObjectDB is !Send;
libxslt serializes every transform behind a process-wide lock), so the
chosen shape is process-level page-range workers: the parent saves the
completed ObjectDB as a SQLite file, partitions the spilled pages into
contiguous chunks, and re-invokes its own binary once per chunk with
LATEXML_RENDER_WORKER=<manifest.json>. Each child attaches the db
readonly (WAL — N readers share one page cache via mmap), runs the SAME
per-page pipeline as the serial driver
(crate::post::render_spilled_page), and reports its diagnostic tally
as trailing Status: lines on stderr. The parent folds child logs and
counts deterministically, in chunk order, into its own LOG_BUFFER /
REPORT — so the combined verdict and the persisted --log stay lossless
(canvas signal-integrity rule: a child that dies without a status line is
folded as FATAL, never as success).
Env knob: LATEXML_RENDER_JOBS (usize). Default 1 = the serial path,
byte-identical to before this module existed.
Structs§
- PageJob
- One spilled page for a worker to render: the spill path plus the metadata
that does not survive the XML round-trip (mirrors
post::SpilledPageminus the parent-only placeholder flags). - Page
Opts - The serializable subset of
PostDocumentOptionsa worker needs to reconstruct the page parse — ALL of its fields, since evendestination(later overridden per page) feeds the site-directory fallback insidePostDocument::new. - Render
Manifest - Everything a page-render worker needs to rebuild the pass-B processor set
exactly as the parent would have, plus its page range. Written as
render-manifest-{i}.jsonbeside the savedrender.db.
Functions§
- worker_
main - Entry point of the hidden worker mode (
LATEXML_RENDER_WORKER=<manifest>), dispatched from the binary’smainbefore any CLI handling. Renders the manifest’s page range and ALWAYS ends its stderr with the status report — even when the manifest cannot be read — so the parent never mistakes a broken worker for a clean one.