Proebsting's Law

Simon Wistow simon at thegestalt.org
Wed Dec 14 12:55:25 GMT 2005


On Wed, Dec 14, 2005 at 12:00:23PM +0000, Paul Makepeace said:
> Pick some code, gcc -O3 and gcc it and run them.
> 
> I bet there's *much* more than 4% difference[1]. 

To be fair to him he says 4x so 400% difference.

I downloaded the mandelbrot.c program from here

http://shootout.alioth.debian.org/benchmark.php?test=mandelbrot&lang=gcc&id=0

added a #include <stdlib.h> to quell the warning about atoi and then 
compiled with


% /usr/bin/gcc -pipe -Wall -O3 -fomit-frame-pointer -funroll-loops \
	mandelbrot.c -o mandelbrot.opt
% /usr/bin/gcc mandelbrot.c -o mandelbrot.unopt
% time ./mandelbrot.unopt_run 10000 > unopt.pbm
131.900u 0.250s 2:12.10 100.0%  0+0k 0+0io 81pf+0w
%  time ./mandelbrot.opt_run 10000 > opt.pbm
46.010u 0.120s 0:46.28 99.6%    0+0k 0+0io 80pf+0w


This on a dual Xeon 2.40GHz with 4Gbs of RAM.

So optimised was about 2.6 times faster. 










More information about the london.pm mailing list