Make the compression_level at settable option and expand it to zlib #540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make it possible to use setOption to set
Memcached::OPT_COMPRESSION_LEVEL
which I had missed in my original zstd PR #539zlib compression was using the default zlib compression level of 6. With this PR it is now possible to choose other levels for zlib as well. I have left the default at 6 so nothing will change for people upgrading unless they explicitly set a different level.
And here is some more bench marking data using php serialized data - https://gist.github.com/rlerdorf/b9bae385446d5a30b65e6e241e34d0a8
From this I think it is clear that fastlz is not really useful at any value size anymore. If you are looking for lightning quick compression and decompression, zstd at level 1 is generally a better choice.
I did not apply the compression_level to fastlz because it only has 2 and it currently switches from 1 to 2 automatically for values larger than 65535 bytes. Forcing it to one or the other doesn't seem useful.