[antlr-interest] Re: ANTLR Java Code Generation
Robert Colquhoun
rjc at trump.net.au
Wed Nov 14 00:49:47 PST 2001
At 11:47 PM 11/13/01 +0000, tom at psy.unsw.edu.au wrote:
>With all the extra loop overhead. Thus your time is now O[x*n] (where
>x is number of instructions to do for each entry). Is this actually
>going to be a gain? You still have to add the same number of entries.
>Just trades off class size vs. speed doesn't it. And I would have
>thought for many cases speed was more important than class size. You
>only store\load the class once, you have to do the BitSet creation
>every parse (if you did 2 passes with one init, then you'd double the
>amount of computation (and thus overhead) but same memory overhead).
For most typical grammers most of the BitSet's are static ie very long lived
For my Arev/Pick BASIC to java bytecode compiler, HPJMeter profiler gives
method counts:
41102 antlr.collections.impl.BitSet.member
41029 antlr.collections.impl.BitSet.bitMask
41029 antlr.collections.impl.BitSet.wordNumber
54 antlr.collections.impl.BitSet.<init>
For <init> breaking down by caller:
47 org.maverickdbms.tools.BASICParser.<clinit>
6 org.maverickdbms.tools.BASICLexer.<clinit>
1 org.maverickdbms.tools.ByteCodeTreeWalker.<clinit>
ie they are all static.
Look at how important it is to optimize the member() function(bitMask and
wordNumber are called from member) it is called 1000x more often than the
constructor.
- Robert
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list