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

Sander Mägi sander at aqris.com
Tue Oct 2 06:55:48 PDT 2001


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. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20011002/11855cac/attachment.html


More information about the antlr-interest mailing list