-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Build clrcompression.dll with optimized Zlib-Intel #5674
Conversation
Thanks, @bjjones. Does this / how does this affect compression levels / output file sizes? |
For the Canterbury Corpus at CompressionLevel Optimal using deflateStream, I saw:
Also noted in the Zlib-Intel Whitepaper, there are very small increases in compression ratio: http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/zlib-compression-whitepaper-copy.pdf |
Thanks for the data. What about at Fastest? |
In the same scenario, I saw a slightly improved compression ratio using CompressionLevel Fastest.
|
How many of the zlib-intel files are different than their zlib-adler equivalents? For those that are the same, could we just modify the CMakeLists for zlib-intel to reference the ones in zlib-adler? So we don't have the duplication of identical files and it's also easier to see what zlib-intel changes. It would mess up the MakeFile build, but we don't use that anyways. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be configured based on the type of build being done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. This is the default setting. It is set on lines 19/20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Why change the default? Don't we normally default to debug unless release is explicitly chosen?
I ran the perf&unit tests again on the zlibs produced by the cmake build and replicated your results. Looks good other than a few minor comments about duplication :) |
@mellinoe OSX_Release failure https://github.com/dotnet/corefx/issues/4833 presumably |
On x86/x64 platforms, use Zlib-Intel for native compression instead of Zlib-Adler. Performance tests show a +30% improvement when compressing files by using SSE4.2 features. ARM platforms still use Zlib-Adler for clrcompression.dll Fix #3986
Unnecessary/duplicate files have been removed and I added a README.txt to the Zlib-Intel folder. |
LGTM. @stephentoub ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what other potential future values __BuildArch could/should be, but should this just be an else
?
A few nits, but generally looks good to me. |
Thanks, @bjjones. |
Build clrcompression.dll with optimized Zlib-Intel
Build clrcompression.dll with optimized Zlib-Intel Commit migrated from dotnet/corefx@1295b0a
#3986 Zlib-Intel is an improved version of Zlib that contains optimizations for processors with the SSE4.2 instruction set. In the most common case of CompressionLevel Optimal, we see a +25-30% performance improvement.
Currently, the version of clrcompression.dll built in the repo is not copied into any of the tests, so to test I manually copied the binary into System.IO.Compression.Tests and ran the test manually resulting in no errors.
Please note that due to a gzip incompatibility I have modified the library to no longer use the agressive deflate_quick strategy and instead use the traditional deflate_fast strategy for CompressionLevel Fastest. This causes performance for CompressionLevel Fastest to be similar to Zlib-Adler.
For ARM platforms, clrcompression.dll is still built using Zlib-Adler.
Performance numbers gathered on an Intel Core i5-4670 CPU for the Canterbury Corpus Benchmark follow:
@ianhays @stephentoub @joshfree