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

feat: faster ZipCrypto decryption (via Rust), dropping support for Python 3.6 #107

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

osimuka
Copy link
Contributor

@osimuka osimuka commented Oct 8, 2024

This decreases the time to decrypt ZipCrypto ZIPs by approximately a factor of 10 (measured using 100MiB of random data zipped).

This uses pyo3 to make Rust code available to Python. However, recent versions of pyo3 don't support Python 3.6 (and older don't seem to support Python 3.12 onwards), and judging the factor of 10 worth it to drop support. And Python 3.6 has been end-of-life for almost 3 years, so perhaps it's time.

Did do a few quick comparisons between https://docs.rs/crc32fast/latest/crc32fast/ and the crc32 library used here, https://docs.rs/crc32-v2/latest/crc32_v2/, and the one here was a bit faster. Suspect it's because here we just call crc32 one byte at a time, and the "fast" version has overhead per call and we never get that time back

@osimuka osimuka requested a review from michalc October 8, 2024 10:06
@osimuka osimuka self-assigned this Oct 8, 2024
@michalc michalc changed the title Feature/faster zip crypto decompression feat: faster ZipCrypto decompression (via Rust) Oct 20, 2024
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 2 times, most recently from 29ceb77 to 5009e51 Compare October 20, 2024 15:29
@michalc michalc changed the title feat: faster ZipCrypto decompression (via Rust) feat: faster ZipCrypto decryption (via Rust) Oct 20, 2024
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 6 times, most recently from 1d22419 to 10b05cf Compare October 20, 2024 17:23
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 4 times, most recently from 3b6158a to 0d7f1ed Compare October 20, 2024 17:57
@michalc michalc changed the title feat: faster ZipCrypto decryption (via Rust) feat: faster ZipCrypto decryption (via Rust), dropping support for Python 3.6 Oct 20, 2024
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 5 times, most recently from fffa400 to 55debc9 Compare October 20, 2024 18:18
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 3 times, most recently from 0402cab to a1976ad Compare October 20, 2024 18:30
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 2 times, most recently from 414a8b2 to e615a7e Compare October 20, 2024 20:26
michalc and others added 2 commits October 20, 2024 21:30
Co-authored-by: Uka Osim <[email protected]>
Co-authored-by: Michal Charemza <[email protected]>
It's been end-of-life for almost 3 years now. And in an upcomming commit will
be using pyo3 to compile Rust for faster ZipCrypto decompression, and its
recent versions also don't have support for Python 3.6 (and its older versions
don't support Python 3.12 or Python 3.13)

Co-authored-by: Uka Osim <[email protected]>
Co-authored-by: Michal Charemza <[email protected]>
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch from 10cde4b to ad8ea92 Compare October 20, 2024 20:30
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch 10 times, most recently from 287c52e to dc96706 Compare October 21, 2024 07:37
This decreases the time to decrypt ZipCrypto ZIPs by approximately a factor of
10 (measured using 100MiB of random data zipped).

This uses pyo3 to make Rust code available to Python. However, recent versions
of pyo3 don't support Python 3.6 (and older don't seem to support Python 3.12
onwards), and judging the factor of 10 worth it to drop support. This is why we
dropped Python 3.6 support in an earlier commit.

Did do a few quick comparisons between
https://docs.rs/crc32fast/latest/crc32fast/ and the crc32 library used here,
https://docs.rs/crc32-v2/latest/crc32_v2/, and the one here was a bit faster.
Suspect it's because here we just call crc32 one byte at a time, and the "fast"
version has overhead per call and we never get that time back.

Co-authored-by: Uka Osim <[email protected]>
Co-authored-by: Michal Charemza <[email protected]>
@michalc michalc force-pushed the feature/faster-zip-crypto-decompression branch from dc96706 to a1c5160 Compare October 21, 2024 07:39
@michalc michalc merged commit 970c681 into main Oct 21, 2024
11 checks passed
@michalc michalc deleted the feature/faster-zip-crypto-decompression branch October 21, 2024 10:14
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.

2 participants