[haiku-appserver] Re: [Haiku-commits] r14599 - haiku/trunk/src/servers/app

  • From: "Mikael Jansson (mailing lists)" <lists@xxxxxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Wed, 02 Nov 2005 13:03:03 +0100 CET

>
> >     Hmmm... GCC is smart? :-)
> 
> At least not completely dumb.
> 
> >     Are you sure not other instruction is executed in the first 
> > test?
> 
> Feel free to play with it yourself (pass "-S" instead of "-c" to let 
> gcc 
> generate assembly). At least the fact that with optimization turned 
> on the 
> same code is generated for both functions should be reassuring that 
> gcc is 
> clever enough to juggle with local variables in an effective way.
> 
Premature optimization is the root of all evil.  Please trust GCC, 
developer time is far more valuable than machine time, anyway. :)

These kinds of micro-optimizations on a C level is meaningless if you 
have a peek into what optimization GCC does for you internally.

Search for "Example of multipass compiler: gcc"

http://www.cs.chalmers.se/Cs/Grundutb/Kurser/komp/current/lectures/ccc01.html

... I wouldn't consider moving a variable in and out of a loop an 
advanced optimization ... :)

Sincerely,
-- Mikael

Other related posts: