[antlr-interest] Performance tweak for .NET antlr library
Micheal J
open.zone at virgin.net
Thu Mar 23 01:44:20 PST 2006
> I've been profiling our application and it looks like there's a small
> tweak to the .NET runtime library's ASTFactory that cuts a
> small amount
> of time out when parsing large amounts of data.
>
> The ASTFactor constructor takes the name of a type, but needs to scan
> all assemblies for an instance of the type. I added a new
> constructor
> that takes System.Type and modified the default constructor
> to pass in
> typeof(CommonAST) instead of "antlr.CommonAST".
>
> I've attached the patched file, but I can generate a proper patch if
> required.
Thanks Matthew.
Using a custom ASTFactory that creates the AST classes directly [i.e. new
MyAST(...)] is another recommended performance tweak.
If a project uses one AST class (i.e. homogeneous AST), using a custom
ASTNodeCreator is a simpler option.
Cheers,
Micheal
More information about the antlr-interest
mailing list