Commit fd79dab
committed
perf(inflate): widen [512,2048)-byte initial output estimate to 160x
fzip's two-block periodic encoder now packs 100 KiB into ~700-750 bytes (~140x),
which fell just under the previous 96x initial-buffer estimate and forced a
mid-decode realloc plus a full-buffer copy. Inputs this small are exactly the
ones most likely to be highly compressible (runs, periodic, sparse), so bias the
estimate higher for this size class; the buffer is trimmed to the exact length
afterwards, and output is byte-identical.
inflate decompress (native, isolated, 100K periodic seq):
- raw deflate: 15.17 -> 12.91 us (-14.9%)
back to ~flat vs the pre-periodic baseline (12.17 us); the residual is the
bulk block's tiny dynamic-table build.
- <512-byte and >=2048-byte inputs are untouched (zeros/random unaffected).
- All 367 tests pass on wasm-gc, native, js. No public API change.1 parent 915e191 commit fd79dab
2 files changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | | - | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
| |||
0 commit comments