[antlr-interest] Is this Recognizer optimization valid [more details]

mzukowski at bco.com mzukowski at bco.com
Tue Oct 2 07:40:23 PDT 2001


Looks good to me.

Monty

-----Original Message-----
From: Sander Mägi [mailto:sander at aqris.com]
Sent: Tuesday, October 02, 2001 6:56 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Is this Recognizer optimization valid [more
details]


 
Did the measurments and original version generated 30% more ASTPair objects.
----- Original Message ----- 
From: Sander Mägi 
To: ANTLR 
Sent: Tuesday, October 02, 2001 3:48 PM
Subject: [antlr-interest] Is this Recognizer optimization valid?


Hi
 
I did some search and replace on my JavaRecognizer.java file (from java.g)
to gain speed and memory - it seems to work in my tests.
 
Maybe someone can confirm that this optimization is indeed correct.
 
I defined a variable:
private static final ASTPair NULL_PAIR = new ASTPair();

And replaced all occurences of 'new ASTPair()' with
'(inputState.guessing==0)?new ASTPair():NULL_PAIR;'
 
This makes garbage collector very happy and makes program a bit faster too.
 
br,
Sander Mägi

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20011002/02697546/attachment.html


More information about the antlr-interest mailing list