[antlr-interest] Lazy load of CommonTokenStream??
Gavin Lambert
antlr at mirality.co.nz
Sun Aug 17 14:04:43 PDT 2008
At 08:14 18/08/2008, Jim Idle wrote:
>Right - so, if size is called a lot then you will add the if to
>that too. I think that internally size won't be called before
>something else has already called fillBuffer(). So my point is
>that we should look at all the paths and cover all the runtime
>possibilities, then see if it makes sense to have the if in
>size() - as in, can it be added there without increasing the
>overall checking done for if (p==0). I found the call to size()
>to be significant enough that I wanted to optimize it, and while
>a check for an integer == 0 is quick, it is still overhead.
I suspect that LA() is being called significantly more often than
size(), so it's probably not a big deal :)
More information about the antlr-interest
mailing list