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

Use non-streaming mode and default compression level 6 #22

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

agners
Copy link
Collaborator

@agners agners commented Oct 17, 2023

The streaming mode (using | before the compression) seems to be quite a bit slower. This restricts the input to a file, but which is typically the case.

The compression level of 6 is the default and significantly increases performance with similar compression ratio.

In a test using Home Assistant Supervisor's Backup functionality backup time decreased from 4min 21s to 3min 33s without streaming mode, and further down to 2min 32s with compression level set to 6. The compression level 6 increased only by 1MB (at 632.8MB to 633.8MB), altough about 90% of data were not compressable data (JPEG). But also other comparision benchmark only report marginal difference in compression ratio.

The streaming mode (using | before the compression) seems to be quite a
bit slower. This restricts the input to a file, but which is typically
the case.

The compression level of 6 is the default and significantly increases
performance with similar compression ratio.

In a test using Home Assistant Supervisor's Backup functionality backup
time decreased from 4min 21s to 3min 33s without streaming mode, and
further down to 2min 32s with compression level set to 6. The
compression level 6 increased only by 1MB (at 632.8MB to 633.8MB),
altough about 90% of data were not compressable data (JPEG). But also
other comparision benchmark only report marginal difference in
compression ratio.
@agners
Copy link
Collaborator Author

agners commented Oct 17, 2023

Currently we can only apply this optimization for non-encryption mode.

In Python 3.12, tarfile will support compression levels in streaming mode as well, which should bump speed at least a bit.
https://docs.python.org/3/library/tarfile.html

@agners agners force-pushed the lower-compression-level-to-tar-default branch from f11fbb2 to 5fde392 Compare October 17, 2023 22:59
@agners agners merged commit ee183b9 into pvizeli:main Dec 4, 2023
1 check passed
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