gzip is faster with -O3

Brooks Davis brooks at one-eyed-alien.net
Wed Aug 9 22:53:18 UTC 2006


On Wed, Aug 09, 2006 at 05:31:58PM -0500, Nikolas Britton wrote:
> On 8/9/06, Matthias Andree <matthias.andree at gmx.de> wrote:
> >
> >1. gzip isn't usually used to compress incompressible data.
> >
> >2. use "time" to figure out how much CPU time it actually burns.
> >   5 GB are somewhat I/O bound, but gcc options don't help with that, so
> >   CPU time is better than wallclock time.
> >
> 
> dd if=/dev/zero of=testfile bs=1m count=5000
> 
> gzip comiled with -O3
> # time nice -10 ./gzip -c9 testfile > /dev/null
> 73.187u 8.682s 2:08.41 63.7%    70+617k 40161+0io 0pf+0w
> 
> gzip compiled with -O2
> # time nice -10 ./gzip -c9 testfile > /dev/null
> 61.183u 8.468s 2:00.14 57.9%    58+609k 40162+0io 0pf+0w
> 
> Now... what do all of those numbers mean, I've never used time
> before... thanks for the tip btw?

In this case the used a similar amount of system time (the number ending
in s), but the -O3 case took 8 seconds more user time (the number ending
in u) and real time (the third number.)  If this were statisticaly
meaningful, -O3 would be slower in this case.  If you want to do a
meaningful test you need to do several runs each way, probably ignoring
the first one due to cache effects and then run the results through
the program you can build in src/tools/tools/ministat/ so see if there
is a measurable difference.  Poul-Henning Kamp has a nice (if probably
somewhat overkill for this case) writeup on doing benchmarking here:

http://lists.freebsd.org/pipermail/freebsd-current/2004-January/019595.html

It's a tricky business even for something simple. :)

You might also consider using /usr/bin/time instead of the csh builtin
time.  It's output is a little more readable.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060809/fc5b2664/attachment.pgp


More information about the freebsd-stable mailing list