Skip to content

perf (speculative): five micro-candidates (round 2) — evaluate each before any work #36

Description

@JavaGT

Filed by the Account-2 read-only amplifier (2026-09-18, HEAD 246b710; coordinator + 3 read-only workers; static evidence only — no benchmark or script was run, per the read-only contract). Five low-stakes candidates from the audio/read data-plane sweep (round 2, after #28). Each is evaluate whether it is worth doing — implementation is explicitly NOT the todo. All evidence coordinator-verified (read + rg).

  1. Sidecar writeJson trio sits on the critical path before the download pool starts — openbook.json / openbook-extra.json / loan.json are stringify+writeFileSync at src/archive.mjs:81,84,91, all before mapLimit at :98. Kicking the pool first (or async sidecar writes) hides stringify/write CPU under network wait. ms-scale, grows with TOC size. Evaluate: check real openbook.json sizes in collected payloads before bothering.
  2. Double stat on the resume check — archive.mjs:101 does existsSync(dest) ? statSync(dest).size : 0 — two syscalls where one try { statSync } suffices. Nano; fold into any other archive.mjs edit or decline.
  3. Cover is fully buffered in memory — metadata.mjs:58-63 downloadCover uses fetchBuffer (entire max-res image resident) then sync writeFileSync, vs streaming to disk the way downloadPart does. Peak-memory-only (MBs), not wall time. Evaluate: are multi-MB covers common?
  4. collect() transient 2× residency per body — http.mjs:50-53 pushes chunks then Buffer.concat, so chunks + result coexist: per-body peak ≈ 2×. A Content-Length-preallocated buffer filled in place halves it (fall back to concat when no CL). Speculative: is peak RSS during the 4-way asset phase a real constraint on multi-MB magazine scans? Distinct from perf T3-W1: collect() utf8-decodes + JSON.parse-attempts every binary body (covers, page assets) — make text/json lazy #4 (laziness, landed) and perf (speculative): six micro-candidates — evaluate each before any work #28.3 (sentinel).
  5. Per-asset base rewrite — archive-read.mjs:140 re-runs web.replace(/\/$/,'') per asset; extractSpine already computes the identical base (openbook.mjs:320). Nano; only worth a one-liner if perf (evaluate): readable path fetches every page before the first asset RTT — overlap the two mapLimit phases #22's rework touches this code anyway.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions