[antlr-interest] wow; talk about premature optimization

Scott Stanchfield scott at javadude.com
Wed Mar 30 20:22:09 PST 2005


> Java VMs probably just 
> aren't too good at switches unless they are consecutive values.

Yep - there are two bytecodes for switches -- one is just a simple offset
table for densely populated values, while the other has to do a two-hop
lookup...

> So, I am tentatively switching back to pure java, no bytecodes.   

Good -- glad to hear it...

Next time, remember -- write it for good design, then profile, then tweak...
You'll rarely outguess a compiler & optimizer

> Apparently I did the bytecode stuff for "fun".  No biggie as 
> I really wanted to learn how to gen .class files and generate 
> bytecodes.  I'm well prepared for a grad programming class now. :)

Yup -- can be fun... Did you use the jakarta bytecode stuff (BCEL?) or
hand-roll?

(I wrote a bytecode assembler for a C++ to PicoJava compiler once... fun
stuff...)

- Scott





More information about the antlr-interest mailing list