On Wed, 20 Mar 2002, Allan Whiteford wrote:

> Is their not a difference between optimising a piece of code (in a
> textbook computer science type way) and choosing the correct algorithm
> (by actually engaging your brain)?

Not really, if you're hand optimising some code you may be better off
picking a better algorithim. Ultimatley your goal is to make it run
faster, few will care which way you do it.

> I also think that, for the former, gcc -O2 will do a far better job than
> most people[1].

Normally, although you may want -O3 on code units with function calls
in tight inner loops so that you get function inlining and possibly
-funroll-loops if the loop length can be determined at compile time
(this isn't turned on for any O level).

- Aidan

-- 
[EMAIL PROTECTED]  http://www.velvet.net/~aidan/  aim:aidans42
finger for pgp key fingerprint: |-----------------------------
01AA 1594 2DB0 09E3 B850        | Money, honey. Cold cash is
C2D0 9A2C 4CC9 3EC4 75E1        | all that counts

--------------------------------------------------------------------
http://www.lug.org.uk                   http://www.linuxportal.co.uk
http://www.linuxjob.co.uk               http://www.linuxshop.co.uk
--------------------------------------------------------------------

Reply via email to