compose.go has no form cache, so every tile gets its own copy of the source page's content stream. Resources are not affected — reader.Writer.Copy dedupes by source object — so this is the page's own content bytes and nothing else.
NUp and Booklet have always had this property; Poster makes it acute rather than introducing it, because it is the one verb whose tile count grows as a product: a 4×4 poster of a 100-page document embeds 1600 copies.
The fix belongs in compose.go and changes all three verbs at once, which is why it was deliberately left out of the PR that added Poster (#21).
Measure before fixing. The claim above is read off the code, not off a file size. A first step is a test that posters a document with a large content stream at 2×2, 3×3 and 4×4 and records the output size, so the growth is a number rather than an argument — and so the cache can be shown to have removed it.
compose.gohas no form cache, so every tile gets its own copy of the source page's content stream. Resources are not affected —reader.Writer.Copydedupes by source object — so this is the page's own content bytes and nothing else.NUpandBooklethave always had this property;Postermakes it acute rather than introducing it, because it is the one verb whose tile count grows as a product: a 4×4 poster of a 100-page document embeds 1600 copies.The fix belongs in
compose.goand changes all three verbs at once, which is why it was deliberately left out of the PR that addedPoster(#21).Measure before fixing. The claim above is read off the code, not off a file size. A first step is a test that posters a document with a large content stream at 2×2, 3×3 and 4×4 and records the output size, so the growth is a number rather than an argument — and so the cache can be shown to have removed it.