[antlr-interest] BENCHMARK. ANTLR. Bad results.

Alex Sedow alexsedow at mail.ru
Sat Nov 13 00:21:41 PST 2004


> And I remember on this list one guy from Russia have write 5-7 tips which
he
> have apply to generated parser and have made it several times faster.
> I also going to find his letter and check if this can work for us.
>
>
> --
> Best regards,
> Ruslan Zasukhin      [ I feel the need...the need for speed ]
> -------------------------------------------------------------

Hello Ruslan!
Thank you, for remember me.
And thank you for confirm my conclusion - ANTLR/C++ lexer+parser 10 times
slower than hand-written C++ lexer+parser.

Of course, ANTLR/C++ must use its own string. Because custom string may
speed up parsing speed about 3-4 times. In my parsers I use special hash
string class. All structures (tokens, AST nodes) contains smart pointers to
hash strings.
Hash string internals:
offset, size, comment
0, 4, hash code <- pointers refers there
4, 4, reference counter
8, 4, string length
12, N, string (where N is sizeof of ASCIIZ string)
This structure is variable-sized and it always aligned to 2^M size. And I
use custom allocators for allocate/deallocate memory for this structure -
one allocator for every 2^M size (custom allocator on synthetic tests about
15-60 times faster than standart MSVC new).

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