mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Performance cliff when using large available_in (regression) #169
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aidanhs on GitHub (May 23, 2017).
Introduced in
cdca91b6f5.When compiling the given
test.cfile withscript.sh(just put them both in the same directory and runscript.sh), you should see the following timing differences on compressing a 100MB buffer of zeroes (before and after the commit above):This is most obvious when using
BrotliEncoderCompress(uncomment the relevant 6 lines intest.cand comment out the rest to verify), but I've managed to reduce the problem to demonstrate it withBrotliEncoderCompressStream.The cause appears to be the use of a 'large' value of
available_in. If you swap the commentedpartsizeline to be65536(matching the buffer size used in thebrotool), the performance difference almost vanishes.test.cscript.sh@eustas commented on GitHub (May 23, 2017):
Thanks for the heads-up. Going to investigate it deeper in early June.
@eustas commented on GitHub (Aug 28, 2017):
Slowdown on all-zeroes data will be fixed with #590
For generic data we expect that "1MB+" heuristic provides both faster and denser compression.