mirror of
https://github.com/google/brotli.git
synced 2026-09-22 06:35:52 +00:00
Best values for lgwin and lgblock? #65
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 @MacGritsch on GitHub (Oct 28, 2015).
Hi,
how can I calculate the best values for lgwin and lgblock?
If I use the default values to compress a buffer with only a few KB, brotli allocates 8 MB for the ringbuffer.
I think this makes no sense, so wouldnt it be a good idea to calculate the two values depending on the size of the data that should be compressed?
thx
@MacGritsch commented on GitHub (Oct 28, 2015):
Does this solution make sense?
@jyrkialakuijala commented on GitHub (Oct 31, 2015):
lgwin can be up to 24 in brotli, but the maximum you want to use depends on the capabilities of the client running the decoder. For the mobile web use it might be wise to avoid the levels 23 and 24, and possibly smart to stay at 19.
@MacGritsch commented on GitHub (Oct 31, 2015):
lgwin of 24 bit means more than 50 MB of memory usage.
the question is still active: does my code make sense, and wouldnt it be a good idea to add this functionality functionality to the param-class?
@eustas commented on GitHub (Nov 6, 2015):
This could easily be added to BrotliCompressBuffer method, but impossible for streaming versions (as the data size is unknown).
So, if we add the logic that reduces window size to BrotliCompressBuffer, will it work for you?
@MacGritsch commented on GitHub (Nov 6, 2015):
Why not add the size as an optional parameter to BrotliParams() constructor?
@eustas commented on GitHub (Nov 6, 2015):
It would look a little bit confusing and redundant - lgwin and lgblock already specify the expected use-case. Probably it can be done with some helper function that adjusts BrotliParams given the expected input size...
@sg77 commented on GitHub (Mar 16, 2016):
Yes, that would be good.
At least some formula on the documentation. I'm interested in knowing how can I limit the amount of memory used while decoding by tunning the encoding parameters,
@eustas commented on GitHub (Jun 9, 2017):
Basic formulae is max(24, min(10, log2(size)+0.5)), if memory itself is not a problem.
If memory is a limited resource, then lgwin should be lowered a bit, but for higher qualities, hashers might take more memory than ring-buffer, so cutting lgwin won't give a big win.