On Sat, Jan 05, 2002 at 02:17:21AM +0100, Morten Brix Pedersen wrote: > Package: gcc-3.0 > Version: 1:3.0.3-1 > > I don't know if it's valid for this bug report, but all code I have tried is > slower in g++ 3, here's a simple example:
There's lots of reasons for this. The biggest one is that the conforming libstdc++ v3.0 is muchlarger and more complicated. > (numbers first, code in the bottom) > mbp:~$ g++ benchmark.cpp ; ls -l a.out ; time a.out ; g++-3.0 benchmark.cpp > ; ls -l a.out ; time a.out > -rwxr-xr-x 1 mbp mbp 42840 5 jan 02:14 a.out* > > real 0m13.542s > user 0m6.200s > sys 0m0.220s > -rwxr-xr-x 1 mbp mbp 38016 5 jan 02:14 a.out* > > real 0m20.882s > user 0m9.950s > sys 0m0.080s The default for G++ is, and has always been, to compile without optimization. Try with -O2 (or -Os if size is your concern) (or -O3 in some cases). It may still be slower, but probably much less so. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer