[luau] compiler optimization?

Warren Togami warren at togami.com
Thu May 15 10:52:01 PDT 2003


On Thu, 2003-05-15 at 10:28, Lou Rickard wrote:
> A friend of mine reccommended that I play around with
> compiler optimizations a bit to see what happens.  I
> was a little surprised.
> 
> I have an application that's about 10k lines of C code
> written for linux.  It's multi-threaded.  It doesn't
> do any complicated math.  It compiles to about 1.8MB.
> 
> Compiled with no optimizations its size is 1870614
> bytes.
> 
> Compiled with -O2, it has the same size.  According to
> diff, it's identical to the non-optimized version.
> 
> Compiled with -Os, it has the same size, and according
> to diff, it's identical to the non-optimized version.
> 
> Compiled with -O2 -march=pentium3 -mcpu=pentium3
> -funroll-loops, it has the same size, and according to
> diff, it's identical to the non-optimized version.
> 
> I'm running RH 7.2, with RH's 2.9.6 version of gcc, on
> a pentium3.
> 
> So, I'm a little confused, it seems like the different
> optimizations would have had some impact, even if it
> wasn't an improvement.  Is it me?  Is it the compiler?
>  Is it the relationship I have with the compiler? 
> Have I failed to nurture and provide comfort to it in
> some way?  Where did I go wrong?
> 
> Also, what other optimizations would people reccommend
> that wouldn't break the portability of the code itself
> (ok to take out Makefile/compiler optimizations, not
> ok to write processor specific code)?
> 
> L.R.

IIRC, gcc-2.96 optimization was largely disabled.  I highly recommend
upgrading to Red Hat Linux 9 or Mandrake 9.1 with gcc-3.2.x, which has
excellent optimization.

Warren





More information about the LUAU mailing list