[antlr-interest] ANTLR performance

Kay Röpke kroepke at classdump.org
Fri Jan 16 09:55:46 PST 2009


Hi!

On Jan 16, 2009, at 3:08 PM, Jan Obdržálek wrote:

>
> The grammar generates a pretty standard AST tree (definitely not a
> flat one). Turning off the tree-building mechanism made all the
> difference - it saved about 80% of the running time. Being on par with
> gcc here (although we still need to remember that gcc does a full
> compilation) is quite a nice result for a generated parser.

may i suggest using -ftime-report for gcc?

it gives you:

Execution times (seconds)
  preprocessing         :   0.07 (25%) usr   0.04 (26%) sys   0.11  
(25%) wall
  lexical analysis      :   0.08 (28%) usr   0.07 (40%) sys   0.14  
(31%) wall
  parser                :   0.08 (28%) usr   0.04 (23%) sys   0.11  
(25%) wall
  expand                :   0.01 ( 2%) usr   0.00 ( 1%) sys   0.01  
( 2%) wall
  global alloc          :   0.00 ( 2%) usr   0.00 ( 0%) sys   0.01  
( 1%) wall
  shorten branches      :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.02  
( 4%) wall
  symout                :   0.01 ( 4%) usr   0.01 ( 3%) sys   0.02  
( 4%) wall
  TOTAL                 :   0.27             0.17             0.45

compilation often isn't as expensive as one might think...it's dealing  
with strings that sucks ;)

-fmem-report is also interesting...

cheers,
-k


More information about the antlr-interest mailing list