[antlr-interest] Lexer speed comparison
Alex Sedow
alexsedow at mail.ru
Thu Feb 26 10:38:03 PST 2004
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.
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.
Alex.
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