Skip to content

Add hellishly slow level 13 compression#452

Open
catap wants to merge 1 commit into
ebiggers:masterfrom
catap:level-13
Open

Add hellishly slow level 13 compression#452
catap wants to merge 1 commit into
ebiggers:masterfrom
catap:level-13

Conversation

@catap
Copy link
Copy Markdown

@catap catap commented May 12, 2026

Add the devil's compression level: an extremely slow, ratio first mode above level 12 that spends much more CPU time to squeeze DEFLATE output a little further.

On the Silesia corpus, level 13 reduces total output by 86'990 bytes or 0.134% compared with level 12, while total runtime grows from 29.1 seconds to 1'670.5 seconds, making it about 57 times slower.

Level 13 extends the near optimal parser with costlier parameters, larger text like blocks, broader parse scoring, delayed split commitment, and saved measured parses for final flushing.

Expose the new level through the public API, command line tools, and compression level scripts.

Add the devil's compression level: an extremely slow, ratio first mode
above level 12 that spends much more CPU time to squeeze DEFLATE output
a little further.

On the Silesia corpus, level 13 reduces total output by 86'990 bytes or
0.134% compared with level 12, while total runtime grows from 29.1
seconds to 1'670.5 seconds, making it about 57 times slower.

Level 13 extends the near optimal parser with costlier parameters,
larger text like blocks, broader parse scoring, delayed split
commitment, and saved measured parses for final flushing.

Expose the new level through the public API, command line tools, and
compression level scripts.
@catap
Copy link
Copy Markdown
Author

catap commented May 12, 2026

Full benchamrk on the Silesia corpus:

file level 12 size / time level 13 size / time size diff time diff
dickens 3'688'552 / 1'289 ms 3'684'671 / 83'512 ms -3'881 (-0.105%) +82'223 (+6378.8%)
mozilla 18'267'490 / 4'959 ms 18'235'120 / 110'754 ms -32'370 (-0.177%) +105'795 (+2133.4%)
mr 3'448'571 / 1'627 ms 3'443'723 / 16'260 ms -4'848 (-0.141%) +14'633 (+899.4%)
nci 2'766'224 / 7'935 ms 2'758'044 / 673'648 ms -8'180 (-0.296%) +665'713 (+8389.6%)
ooffice 2'998'130 / 424 ms 2'995'604 / 8'676 ms -2'526 (-0.084%) +8'252 (+1946.2%)
osdb 3'642'347 / 798 ms 3'641'341 / 4'942 ms -1'006 (-0.028%) +4'144 (+519.3%)
reymont 1'702'796 / 1'005 ms 1'699'494 / 81'839 ms -3'302 (-0.194%) +80'834 (+8043.2%)
samba 5'135'662 / 2'889 ms 5'122'812 / 141'227 ms -12'850 (-0.250%) +138'338 (+4788.4%)
sao 5'255'575 / 333 ms 5'255'358 / 1'687 ms -217 (-0.004%) +1'354 (+406.6%)
webster 11'565'754 / 6'452 ms 11'555'293 / 475'196 ms -10'461 (-0.090%) +468'744 (+7265.1%)
x-ray 5'754'248 / 305 ms 5'748'141 / 3'276 ms -6'107 (-0.106%) +2'971 (+974.1%)
xml 633'760 / 1'104 ms 632'518 / 69'504 ms -1'242 (-0.196%) +68'400 (+6195.7%)
total 64'859'109 / 29'120 ms 64'772'119 / 1'670'521 ms -86'990 (-0.134%) +1'641'401 (+5636.7%)

and here a bit more explanation how it works: https://kirill.korins.ky/articles/hellishly-slow-level-13-deflate-compression/

@ace-dent
Copy link
Copy Markdown

ace-dent commented May 12, 2026

@catap - Interesting! It seems tuned for textual information... does it benefit png images?
Have you looked at turtledeflate for block splitting?

How do your results compare to zopfli? I'm surprised at the cost of your approach, for <0.3% gain.

@catap
Copy link
Copy Markdown
Author

catap commented May 12, 2026

@ace-dent base on table in turtledeflate, it loses :)

@catap
Copy link
Copy Markdown
Author

catap commented May 12, 2026

but it can't have infinity loop like Efficient-Compression-Tool and turtledeflate

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.

2 participants