Files
pdfcraft/crates
Grzegorz MartensandClaude Opus 5.5 4acc7e040f M8: what streams share is read once a run, and nothing large is copied for each
Three ways a small file could still make a redaction run long or large:

- direct_parms kept /JBIG2Globals as given, so a direct array there was
  copied for each entry (427 MiB from 32 KB). It is kept only when it is a
  reference, as Document::with_direct_parms keeps it; a direct value is
  no stream, so no decoder reads it.
- The entries copied were bounded only by /Filter's length, and the work
  repeated for every stream that uses a dictionary: time grew with the
  square of the file (117 s from 249 KB). A /Filter longer than any
  decoder takes (MAX_CHAIN, and a /Crypt) is read as no filter, so its
  parameters aren't read either; no decoder reads such a stream anyway.
- named() read every entry of every stream's parameters, through up to
  33 references each, with nothing shared between streams. Names keeps
  what each value the file refers to names, for the whole run, so streams
  sharing an array or an entry cost it once; unshare adds a shared list,
  and finds what it matches, once too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 13:33:36 +01:00
..
…
…
…
…