Skip to content
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

67 investigate switching out zlib ng for libdeflate #72

Merged
merged 29 commits into from
May 27, 2024

Conversation

EmilDohne
Copy link
Owner

This turned out to be quite a large PR as I took this moment to refactor a lot of the compression code and optimize the way the PhotoshopAPI internally compresses and decompresses data by reusing a swap buffer rather than reallocating buffers only to discard them away later.

Additionally we now use libdeflate rather than zlib_ng for compression and decompression as this allows for much greater decompression speeds. We also added memory-mapped files for read operations as this provided significant improvement in read performance.

Overall the speedups are:

  • ~40% in 8-bit reads, ~20% in 8-bit writes.
  • ~20% in 16-bit reads, ~10% in 16-bit writes.
  • ~-5% in 32-bit reads, ~7% in 32-bit writes.

While 32-bit reads did get slightly slower with our benchmark data we did see speedups in all other cases which justifies this change. I will look into equalizing 32-bit read speeds in the future

…D intrinsics as well as more efficient parsing
…ue ref but just a ref instead since passing an r-value ref made no sense without storing it
…fer instead of allocating and returning the buffer
…e difference between all configurations was roughly equal
@EmilDohne EmilDohne linked an issue May 27, 2024 that may be closed by this pull request
@EmilDohne EmilDohne merged commit 003b653 into master May 27, 2024
14 checks passed
@EmilDohne EmilDohne deleted the 67-investigate-switching-out-zlib-ng-for-libdeflate branch May 27, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate switching out zlib-ng for libdeflate
1 participant