[geeks] galeon Doesn't Suck that much....
Jonathan C. Patschke
jp at celestrion.net
Wed Apr 17 11:53:02 CDT 2002
On Wed, 17 Apr 2002, Greg A. Woods wrote:
> Ah ha! I was wondering when someone might claim that.... :-)
>
> Sub-optimal might be bad in some contexts, but very rarely so in the
> case of the quality of compiler generated object code for most
Suboptimal, by definition, means "not quite optimal", which, depending on
the magnitude of "not quite" can equate to "bad" straight-off. However
"suboptimal" always indicates room for improvement.
> unix-based applications, even on slower older machines. Sure my X11
> workstation might be a bit faster if I re-compiled all the software on
> it with the Sun SPARC compiler, but there's still a fundamental limit to
> how fast a 25MHz SS-1+ can move bits around on even a 1-bit deep display!
Very true, but if you're dealing with code that's primarily CPU-bound (not
sbus-bound or gfx-chip bound or memory-bandwidth-bound), poorly-compiled
code -will- slow you down. If this code is in the kernel or in libc.so,
those minor slowdowns can affect things system-wide.
If you really want, I'll run a good sample-test of something CPU-bound
that will fit in the cache of the R10000 here on my desk and give you a
comparison. My experience has been that, not only does MIPSpro[1] generate
faster binaries, it also creates -smaller- binaries (this is with all
debugging info disabled on stripped binaries). This can only mean that
gcc is generating more object code that MIPSpro, therefore generating more
object code than is necessary.
Now, to the credit of the GCC team, the code generated from gcc is
aprooximately as good as the code generated by Microsoft's C compiler,
which is about as close to a "vendor compiler" as you're going to get on
x86, unless you look at Intel's compiler. Intel's compiler blows the
doors off GCC, but probably generates code that annoys non-Intel CPUs.
But, people don't use GCC because it generates tight code--they use it
because it's free and it's -everywhere-, and they're none too bashful
about reminding us of that.
> You know what Knuth says about optimisation...... (and if you don't
> you'd better go read up on it right quick now! ;-)
You should read your Knuth better. Knuth dislikes -premature-
optimization. That is, "optimizing" anytime before the -last- step of the
development process. Clearly, this is why FSF code never gets optimized;
it never -reaches- the last step of development. :)
There's nothing wrong with optimizing code that provably works, so long as
your optimizations don't result in code that is less generic than your
problem specification.
--Jonathan
[1] No experience with Forte C, so I can't comment there, but I've heard
good things.
More information about the geeks
mailing list