-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port Chromium optimizations to zlib #346
Comments
@madler any comment? |
@Adenilson you might get more traction on this if you created a fork of zlib, merged in the Chromium changes, and then opened-up a PR for these changes against this project. I just took 30s to dive into 3rd party zlib link you gave, and it is (I feel) "not immediate" where all of the changes lie. If this is important to you, I think it is only fair if you do some of the leg work. |
@andrewvaughanj thanks for the suggestion. I've created over 1 year ago a merge request for 2 of the ARM specific optimizations (#251) and 3 months ago for another (#345). Notice that those merge requests were ARM specific and targeting decompression only, while Chromium's zlib has also Intel optimizations, which prompted to open the current issue. |
Fair enough; I can see your hesitation to do this if you've already done it twice already (in other areas) and haven't got traction. I wasn't aware of that, so my apologies if you thought I was (to use the British phrase) "teaching you to suck eggs". |
@madler ping? |
Where can I find benchmarks that show the gain? |
Current benchmark data collected this week can be found at: The last 2 weeks I've implemented hash_slide and insert_string for ARM boosting compression performance in average 36% for big cores (14% for littles), if all goes well it will be featured in Chromium M70. For the snappy dataset (https://github.com/google/snappy/tree/master/testdata), the average performance gains for using Z_DEFAULT_COMPRESSION are: The averages can be a bit misleading, as the snappy corpus has files with some really high entropy (bad-data files are around 0.95). For HTML (entropy 0.7) the performance gains are even better (e.g. 1.3x compression, 2.2x decompression on x86). It is relevant to share that zlib is used by Chromium network library (cronet), that is itself used by quite a few of Google Android apps, being widely distributed (i.e. over 1 billion users) and tested. For decompression, the first optimization (inflate_fast_chunk: #345) started shipping in Chromium M62, followed by Adler-32 (M63) and crc-32 (M66). For decompression, the x86 optimizations were landed on Chromium in late 2014 (while the ARM optimizations were just landed the last 2 weeks). |
Sorry, a fix: For compression, the x86 optimizations were landed on Chromium in late 2014 (while the ARM optimizations were just landed the last 2 weeks). |
@madler collected some extra data for x86 (Intel(R) Xeon(R) CPU E5-2697A v4 @ 2.60GHz), hope it might be useful: b) Default (7) c) Vanilla Fastest d) Vanilla Default |
Is this project actively developed in this repo? Latest activity ~2yrs ago for such a big project is sad. |
You can see recent activity in the develop branch. |
@madler ping? Did you have time to have a look on the benchmark data? Should we go ahead and submit a merge request? |
@madler friendly ping? |
A google engineer started to perform compression on Javascript source strings to save memory in Chromium browser tabs and did some benchmarking comparing Chromium's zlib x zstd x brotli. He collected some pretty interesting data on both x86 and ARM, I thought you could be interested in checking: Just download the zip and open the html files in a webbrowser. |
@madler ping? |
@madler should I close the issue? |
@madler what do you think about making a crowdfunding or making a proposal to Google for funding zlib maintenance and development? |
I personally don't need any funding. What would we do with the money? |
Invest in more maintainers in order to integrate e.g chromium zlib optimizations to the benefit of many softwares? |
Why not just use the chromium fork instead? |
Ideally, Chromium's fork shouldn't be the source of truth. Also, Mark has set in motion some things to make it easier for pull requests like this to land. To be honest, I dropped the ball in helping on it. I'll try to pick it back up. :) |
Because zlib is by default on Linux distributions unlike chromium zlib. |
Chromiums zlib implementation causes SIGILL on CPUs without SSSE3 support from what I've gathered. nodejs/node#32553 |
Upon further investigation, it seems to be an issue with the way Node is building the code (i.e. passing -mssse3 to the portable code section): |
* Added cmake build instructions, build options, install instructions, and repository contents to README.md. * Moved INDEX file content to README.md files. * Added configure instructions and options. * Added CodeFactor to build integration.
Chromium has a fork of zlib with optimizations both for Intel (compression, decompression) and ARM (decompression).
It would be pretty nice if those patches could be merged upstream (e.g. 'contrib/chromium').
For reference, chromium's zlib can be found in:
https://cs.chromium.org/chromium/src/third_party/zlib/
A quick list of optimizations:
a) Decompression: inflate_fast, adler32, crc32, etc.
b) Compression: fill_window, longest_match, hash function, etc.
Finally, Chromium also has a pretty nice tool (zlib_bench, see: https://chromium.googlesource.com/chromium/src/+/875ad5e3c08831f1efa91adade7fc350b1ef45bc) that is used to validate the optimizations. I feel that it would be potentially helpful to the project to have something similar.
The text was updated successfully, but these errors were encountered: