Re: [PATCH 2/3] kbuild: handle module compression while running 'make modules_install'.

Rusty Russell
2014-08-19T18:11:35Z

Andi Kleen <andi@firstfloor.org> writes:
> Bertrand Jacquin <beber@meleeweb.net> writes:
>>
>> +# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed
>> +# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP
>> +# or CONFIG_MODULE_COMPRESS_XZ.
>> +
>> +mod_compress_cmd = true
>> +ifdef CONFIG_MODULE_COMPRESS
>> + ifdef CONFIG_MODULE_COMPRESS_GZIP
>> + mod_compress_cmd = gzip -n -9
>
> Please don't use gzip -9. The gain is very small, but it can make
> the time to compress much longer. Just use plain gzip.

Interesting:

$ time find * -name '*.ko' | xargs -n 1 gzip
real 0m9.404s
user 0m7.283s
sys 0m1.667s
$ du -c `find * -name '*.ko.gz'` | tail -n1
56412 total

time find * -name '*.ko' | xargs -n 1 gzip -9
real 1m1.968s
user 0m58.850s
sys 0m1.786s
$ du -c `find * -name '*.ko.gz'` | tail -n1
55764 total

$ time find * -name '*.ko' | xargs -n 1 xz
real 1m23.396s
user 1m13.893s
sys 0m9.134s
$ du -c `find * -name '*.ko.xz` | tail -n1
46868 total

$ time find * -name '*.ko' | xargs -n 1 xz -9
real 1m47.202s
user 1m25.962s
sys 0m21.298s
$ du -c `find * -name '*.ko.xz` | tail -n1
46868 total

So, Andi is right. Please skip -9 for both options: it makes little
(.gz) or no (.xz) difference and it slows things down.

Cheers,
Rusty.