Skip to content

Instantly share code, notes, and snippets.

@vaiorabbit
Created December 13, 2015 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaiorabbit/02576a718b5b204a522e to your computer and use it in GitHub Desktop.
Save vaiorabbit/02576a718b5b204a522e to your computer and use it in GitHub Desktop.
Compression time/ratio comparison between LZ4/GZip/XZ.

Compression time/ratio comparison between LZ4/GZip/XZ.


$ time lz4c bun_zipper.ply

Compressed filename will be : bun_zipper.ply.lz4 
Compressed 3033195 bytes into 1844105 bytes ==> 60.80%
lz4c bun_zipper.ply  0.01s user 0.01s system 91% cpu 0.019 total

$ time gzip -c bun_zipper.ply > bun_zipper.ply.gz

gzip -c bun_zipper.ply > bun_zipper.ply.gz  0.24s user 0.00s system 99% cpu 0.241 total

$ time xz -c bun_zipper.ply > bun_zipper.ply.xz

xz -c bun_zipper.ply > bun_zipper.ply.xz  1.47s user 0.02s system 99% cpu 1.491 total

$ ls -l bun_zipper*

-rw-r--r--  1 foo  staff  3033195  8  5  1996 bun_zipper.ply
-rw-r--r--  1 foo  staff  1071726 12 13 18:00 bun_zipper.ply.gz
-rw-r--r--  1 foo  staff  1844105 12 13 18:00 bun_zipper.ply.lz4
-rw-r--r--  1 foo  staff   842792 12 13 18:00 bun_zipper.ply.xz

$ time lz4c lena_std.tif

Compressed filename will be : lena_std.tif.lz4 
Compressed 786572 bytes into 783529 bytes ==> 99.61%
lz4c lena_std.tif  0.00s user 0.00s system 77% cpu 0.006 total

$ time gzip -c lena_std.tif > lena_std.tif.gz

gzip -c lena_std.tif > lena_std.tif.gz  0.03s user 0.00s system 96% cpu 0.029 total

$ time xz -c lena_std.tif > lena_std.tif.xz

xz -c lena_std.tif > lena_std.tif.xz  0.18s user 0.01s system 98% cpu 0.197 total

$ ls -l lena_std*

-rw-r--r--  1 foo  staff  786572  1  5  2004 lena_std.tif
-rw-r--r--  1 foo  staff  734061 12 13 18:03 lena_std.tif.gz
-rw-r--r--  1 foo  staff  783529 12 13 18:03 lena_std.tif.lz4
-rw-r--r--  1 foo  staff  634640 12 13 18:03 lena_std.tif.xz
@mator
Copy link

mator commented Nov 12, 2020

wrong formatting on time commands

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