[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance of SableCC v ANTLR

Indrek Mandre wrote:
I observed something similar once and then discovered it was my own fault
for I was not using buffered input. Eg. make sure your input stream is
buffered, eg. wrap it into BufferedInputStream.

Of course, using a BufferedReader (or BufferedInputStream) is critical for performance!

Still it would probably help a lot more to benchmark this slowness more
precisely and to measure what part of the parser generation process is
causing you trouble.

Any volunteer? Maybe we could then address some problems easily.

I know that, for example, ignored tokens are allocated and kept around.  Maybe
this causes some efficiency problems in cases where they are not needed.  A
possible solution to this (if benchmarking shows that it really is a problem)
would be to add a command-line option so that they are not allocated.

But as I'm not really familiar with sablecc internals so I can't help you
here any more.

I suspect that any performance enhancement would mainly consist of modifying some templates in src/org/sablecc/sablecc/*.txt.


PS: One exception: currently the generated DFA is *not* minimal.  Minimizing it
would require some modifications to the Java code.

Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/