[antlr-interest] Lexer speed comparison

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Feb 26 11:04:01 PST 2004


on 2/26/04 8:38 PM, Alex Sedow at alexsedow at mail.ru 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.

Mda.... Bad news.

I did not expect so huge difference.

Alex, it seems speed of ANTLR bother only you an me,
I.e. People from Russia and Ukraine :-)

I also during last 2 years have raise SPEED issue many times on this list.
Usually people answer -- we more care about correctness than of speed.

I answer, but what problems to have and CORRECT and SUPER-FAST parser
:-))

Alex, seriously, 

As you know Rick is going to start development of new C++
engine for ANTLR 3.0

You can take BIG PART in this process.
Unfortunalty I cannot help too much.
I am no expert on parsers, and busy on other tasks.

What I can do -- we have grow here SQL92 grammar for Valentina db,
And in nearest months we will grow system of regression benchmarks for it.
This will be of course used with profiler. So we can do profiling and
reporting what is not good.


> 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?

As I know, exceptions are used for complex features of ANTLR,
That with bool result will be very complex for coding.

> 3. Antlr not use special fast strings, std::string not so fast.

STD people say it is.

> 4. Antlr not use allocators (allocators may speed up whole parser speed
> about 3-4 times).

Yes, this can be fact.

Just go ahead and show to ANTLR developers how this can be done.

> 5. Antlr pointers use two pointers scheme
> "pointer->pointer_with_counter->object", scheme
> "pointer->object_with_counter" is faster.

Right, intrusive pointers are faster.

Or if to use conception of interfaces -- I_Unknown + smart_ptr
Is great tool


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



 
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