Filed by the Account-2 read-only amplifier (2026-09-16, HEAD f635e62). Problem (CPU hot path, coordinator-verified):
- Pages double-convert:
pageBodyOf returns d.toString('utf8') (src/epub.mjs:251-255), wrapPage composes strings (src/epub.mjs:296-299 thunk), then resolveData re-encodes with Buffer.from(d,'utf8') when the payload isn't already a Buffer (src/epub.mjs:33-37) before deflate — one full decode+re-encode per page per assembly.
zipChunks yields 3 chunks per entry — 30-byte local header, name, payload (src/epub.mjs:154-158) — so a book pushes hundreds of micro-writes through the pipeline; header+name could share one combined alloc.
zipChunks also re-implements layout()'s offset/dirSize accounting inline (src/epub.mjs:151-153 vs :49-58) — mirrored accounting, drift currently mitigated only by the byte-identity test (test/epub-integrity.test.mjs:131).
Evaluation question (implementation is NOT the todo until measured): buffer-concat wrapping + combined header/name alloc, measured in the bench zip_assembly section — the one harness that exists for this path. Byte-identity tests must stay green. Note: zip_assembly outputBytesAgree:false vs perf/baseline is expected from the intentional rewrite — compare current-vs-candidate, not vs baseline. Deflate level should get a pin regardless (tracked under #19).
Proposed focus packet: wrapPage on Buffers (viewport insert as buffer concat), single header+name alloc in zipChunks, shared accounting helper, bench A/B + epub-integrity green.
Filed by the Account-2 read-only amplifier (2026-09-16, HEAD f635e62). Problem (CPU hot path, coordinator-verified):
pageBodyOfreturnsd.toString('utf8')(src/epub.mjs:251-255),wrapPagecomposes strings (src/epub.mjs:296-299 thunk), thenresolveDatare-encodes withBuffer.from(d,'utf8')when the payload isn't already a Buffer (src/epub.mjs:33-37) before deflate — one full decode+re-encode per page per assembly.zipChunksyields 3 chunks per entry — 30-byte local header, name, payload (src/epub.mjs:154-158) — so a book pushes hundreds of micro-writes through the pipeline; header+name could share one combined alloc.zipChunksalso re-implementslayout()'s offset/dirSize accounting inline (src/epub.mjs:151-153 vs :49-58) — mirrored accounting, drift currently mitigated only by the byte-identity test (test/epub-integrity.test.mjs:131).Evaluation question (implementation is NOT the todo until measured): buffer-concat wrapping + combined header/name alloc, measured in the bench zip_assembly section — the one harness that exists for this path. Byte-identity tests must stay green. Note: zip_assembly
outputBytesAgree:falsevs perf/baseline is expected from the intentional rewrite — compare current-vs-candidate, not vs baseline. Deflate level should get a pin regardless (tracked under #19).Proposed focus packet: wrapPage on Buffers (viewport insert as buffer concat), single header+name alloc in zipChunks, shared accounting helper, bench A/B + epub-integrity green.