Skip to content

Add command to show compression statistics, and a tool to compress - #275

Closed
afbjorklund wants to merge 8 commits into
ccache:masterfrom
afbjorklund:compress
Closed

afbjorklund wants to merge 8 commits into
ccache:masterfrom
afbjorklund:compress

Conversation

@afbjorklund

@afbjorklund afbjorklund commented Jun 17, 2018 •

Copy link
Copy Markdown
Contributor

By default only the .manifest files are compressed, but add a tool to measure the amount of compression.

Also do a small wrapper to help compress all files with --fast, optionally to recompress using --best.

$ ccache -x
Compressed size: 9.8 MB, 22 files
Uncompressed size: 10.0 MB, 68 files
Compressed files: 32.35 %
Compression ratio: 1.34 % (1.0x)
$ ccache-compress 
$ ccache -x
Compressed size: 2.5 MB, 68 files
Uncompressed size: 10.0 MB, 68 files
Compressed files: 100.00 %
Compression ratio: 75.41 % (4.0x)

For large cache directories, compressing will take a long time... But decompression should be fast.

Once the benchmarking tools have been updated, they should have more compress options as well...

Part of #274

By default, only the .manifest are being compressed.
It is possible to use different compression levels...
The decompression speed does not depend on method,
so (re)compress the cache using the --best method.
Doing compression on large directories takes "forever",
so default to --fast and use --best only if instructed.
It is more efficient to compress several at a time,
instead of doing just one with available processors.
The terminology is a bit confused, but have
it match whatever gzip --list is outputting.

Sometimes known as "space savings" instead,
so list both values to make it more obvious.
@mmontag

mmontag commented Jul 26, 2018

Copy link
Copy Markdown

Just passing through, but this would be a really nice improvement!

@jrosdahl jrosdahl added the issue: feature New feature label Aug 8, 2018
@jrosdahl

jrosdahl commented Sep 2, 2018

Copy link
Copy Markdown
Member

I'd rather wait with this until we have decided the future of aggregated files (#218) and if we should switch to LZ4, either as the only compression algorithm or as the default of several.

Does this sound reasonable?

@afbjorklund

Copy link
Copy Markdown
Contributor Author

I think it is just one more function to the compression "API", in order to dry-run the compressed file.

@jrosdahl

jrosdahl commented Jul 3, 2019 •

Copy link
Copy Markdown
Member

Now that the work related to aggregated files and compression has settled, I think that this feature would be awesome to have in the upcoming ccache version.

@afbjorklund: Would you be interested in reworking this PR to work with the new file formats and to implement recompression in ccache itself instead of a standalone tool? (If not, I can have a look at it myself, no problem.)

I'm imagining one option for showing compression statistics, just like the proposed -x flag, and one option for recompressing the cache. Maybe like this?

    -x, --show-compression    show compression statistics                              
    -X, --recompress=LEVEL    recompress the cache using compression level
                              LEVEL (positive or negative integer, or
                              "uncompressed" for no compression)

Thoughts?

@afbjorklund

Copy link
Copy Markdown
Contributor Author

The main problem with the recompression is the threading, but I suppose it can start out single threaded.

@jrosdahl

jrosdahl commented Jul 3, 2019

Copy link
Copy Markdown
Member

The main problem with the recompression is the threading, but I suppose it can start out single threaded.

I agree, no need to parallelize in a first version.

@jrosdahl jrosdahl added this to the 3.8 milestone Jul 3, 2019
@afbjorklund

Copy link
Copy Markdown
Contributor Author

Will close this PR, and make a new one for the new format

@afbjorklund afbjorklund closed this Jul 3, 2019
@afbjorklund afbjorklund removed this from the 3.8 milestone Jul 3, 2019
@afbjorklund

Copy link
Copy Markdown
Contributor Author

Reimplemented in #440

@jrosdahl

jrosdahl commented Oct 8, 2019

Copy link
Copy Markdown
Member

The main problem with the recompression is the threading, but I suppose it can start out single threaded.

I agree, no need to parallelize in a first version.

For reference, I've now implemented -X/--recompress (d8e2ab9) after a rather large refactoring of the code for reading/writing manifests and result files. I also made a threaded implementation as a follow-up (b0bf95c). Testing and opinions on the corresponding documentation (or code, for that matter) would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

issue: feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants