[antlr-interest] wow; talk about premature optimization

Scott Stanchfield scott at javadude.com
Thu Mar 31 05:26:35 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).

Usually for the first year or so of a compiler's life, misguided programmers
keep writing their own assembly code "because real programmers write in
assembler". They might be a wee bit more efficient, but then them compiler
catches up and they're left with some nasty, unmaintainable code that's at
best the same as what the compiler optimizes to (and usually not as good).
Then it's time to rewrite it maintainably ;)

It all boils down to the fact that intuition (& common sense) is a
misdirected optimizer. Go for good, understandable & maintainable design and
let a profiler figure out what you need to tweak into submission.


>I just did it first 'cause it seemed like fun. :)

Of course, and that's a good reason ;)

-- Scott





More information about the antlr-interest mailing list