[antlr-interest] wow; talk about premature optimization

Andy Tripp atripp at comcast.net
Fri Apr 1 08:31:29 PST 2005


>
>
>> On Mar 30, 2005, at 8:22 PM, Scott Stanchfield wrote:
>> > Next time, remember -- write it for good design, then profile, then 
>> > tweak...
>> > You'll rarely outguess a compiler & optimizer
>> 
>> Without doing the bytecodes at some point, how could one 
>> compare?  
>
>History, my friend. People have been attempting to do this for years and the
>compilers always win (or at least they do after the compiler writers have
>had a year or two to optimize).
>

Yup. What's really sad is that often these people who are so clever that 
they think
they can out-optimize a compiler write all that code by hand and never 
go back to
do thorough benchmarking to see if they've accomplished anything. Then they
keep their hand-written code, and years later someone else is sick of 
maintaining
it, so takes out the optimization and...

Poof! It's just as fast any maybe faster!

Brian Kernighan once said "If you ever come across a section of your 
code that you find
particularly clever, strike it out and do it again". I'm not sure if 
that's the exact quote,
but it's pretty close.

Andy :)




More information about the antlr-interest mailing list