by jwilk · 8y ago · 0 comments
You can save a lot of bandwith by requesting compressed responses:
$ curl -s --user-agent moo/1 -H 'Accept-Encoding: gzip' "$pretty_long_url" > test.gz
$ wc -c < test.gz
63507
$ gzip -d < test.gz | wc -c
426941
(OK, that's 85% saved, not 95%, but hey.)If you do it right you can even keep the content stored compressed without re-compressing by saving the compressed byte stream directly.
https://github.com/madler/pigz/issues/36#issuecomment-249041...
Decompression can’t be parallelized, at least not without specially prepared deflate streams for that purpose. As a result, pigz uses a single thread (the main thread) for decompression, but will create three other threads for reading, writing, and check calculation, which can speed up decompression under some circumstances.