optimize

command
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Optimize compares the default writer with the optimized writer (cross-reference streams per ISO 32000-1 §7.5.8 plus object streams per ISO 32000-1 §7.5.7, orphan sweep over §7.5.4 reachability, and Flate recompression of eligible payloads per §7.4.4) across several document shapes and reports the byte-size delta for each.

The compression ratio depends heavily on what the document contains: content streams produced by Folio's writer are already at zlib.BestCompression and cannot benefit from re-deflate, so layout- built documents see most of their gains from object-stream packing and the orphan sweep. Imported documents (built by parsing a source PDF and copying pages into a new Document) carry their content streams in raw plaintext form — that is where recompression wins big.

Usage:

go run ./examples/optimize

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL