Skip to content

perf: small inflates start small and skip unread tables - #103

Merged
Chimi6 merged 1 commit into
mainfrom
small-inflate
Sep 28, 2026
Merged

Chimi6 merged 1 commit into
mainfrom
small-inflate

Conversation

@Chimi6

@Chimi6 Chimi6 commented Sep 28, 2026

Copy link
Copy Markdown
Owner
  • One-shot inflate of a small input starts from a slab of 4x the input (at least 4 KB) and doubles, instead of a zeroed megabyte per call (a map, its faults, and an unmap).
  • The packed literal table is built only for one-shot inputs of 4 KB and up (and always for streaming inflaters); packed copies of the distance and code-length tables are no longer built (only the literal table's is read); the long-code scratch table is skipped when no code passes 12 bits.
  • A 300-page PDF whose pages are 14,400 small content streams: 0.61 -> 0.13 s, output identical. xlsx -> csv 1891 -> 1830 ms, pdf -> png 386 -> 367 ms; docx -> md 1753 -> 1813 (the same streaming inflater; recorded as layout, margin 75x over pandoc).
  • Test: a small input inflating far past its first slab, and a small dynamic block without the packed table.

@Chimi6
Chimi6 merged commit 3191197 into main Sep 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant