[antlr-interest] Lexer speed comparison
Terence Parr
parrt at cs.usfca.edu
Thu Feb 26 17:57:32 PST 2004
On Feb 26, 2004, at 10:38 AM, Alex Sedow wrote:
> Comparison with hand-written code.
> I test two parsers for rc-files:
>
> 1. Antlr/C++-based (lexer+parser).
> 2. Hand-written (C++) (lexer+parser+tree generator).
>
> Results:
>
> Antlr/C++-based - 0,85 Mb/s.
> Hand-written (C++) - 11,4 Mb/s. (second run pure lexer speed is about
> 70
> Mb/s).
>
> Antlr-generated code cannot used directly in real commercial projects
> because it too slow. Antlr maybe used only for debug and research
> grammars.
Hi Alex,
Well, I'm not sure that follows from that speed test, though I can
easily understand your frustration. There are many companies that use
ANTLR for real work; just check the showcase. :)
> Antlr/C++ 2.x has some handbrakes:
> 1. Lexer generator that produce slow code. What about re2c?
> 2. try/catch blocks in parser-generated code. What about return bool?
> 3. Antlr not use special fast strings, std::string not so fast.
> 4. Antlr not use allocators (allocators may speed up whole parser speed
> about 3-4 times).
> 5. Antlr pointers use two pointers scheme
> "pointer->pointer_with_counter->object", scheme
> "pointer->object_with_counter" is faster.
Thanks for the valuable feedback. You have my pledge to address
efficiency in ANTLR 3.0 :) Recall that ANTLR 2.x was built under
duress while working at a startup. Now I am a full time
student-torturer and researcher :)
Best regards and thanks for at least looking at ANTLR.
Terence
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list