Sean Chittenden wrote:
Howdy. Having been fed up with bison/yacc, I switched to using lemon
and have found lemon to be a vastly more enjoyable tool to work with
compared to bison (thank you!). That said, before I embarked on my
wholesale conversion to lemon, I went and recreated a calculator using
both lemon and bison and found that bison was about 2x faster than
lemon (much to my surprise).

I'm interested in fixing this. The last time I compared the speed of the two (in 1989) lemon was faster. But I imagine bison has changed somewhat in the intervening years.


[...]

Of note from the gprof output was the following from the lemon based calc:

  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 47.3       4.76     4.76                             __fix_locale_grouping_str [1]
 15.1       6.28     1.52 24312002     0.00     0.00  Parse [2]
 11.3       7.42     1.14                             _mcount [5]
 10.5       8.47     1.06  5335001     0.00     0.00  yylex [4]
  2.6       8.73     0.26  4546001     0.00     0.00  symlook [10]
  2.0       8.94     0.20                             yy_pop_parser_stack [6]
  1.7       9.11     0.17                             main [8]
  1.3       9.24     0.13                             yy_shift [7]
  1.2       9.36     0.12                             yy_reduce [3]
  1.0       9.46     0.10                             strtod [11]
  1.0       9.56     0.10  5335001     0.00     0.00  ParseAlloc [12]
  0.8       9.64     0.08                             addfunc [9]

where as bison's profile was the following:

  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 32.4       1.50     1.50        1  1498.05  3233.40  yyparse [2]
 29.1       2.84     1.35  5335001     0.00     0.00  yylex [3]
 25.9       4.04     1.20                             _mcount [4]
  5.2       4.28     0.24  1867000     0.00     0.00  strtod [6]
  4.2       4.48     0.20                             .mcount (62)
  0.7       4.51     0.03  1867000     0.00     0.00  atof [5]


I'm using lemon 1.16 from CVS and would love any advice that people may have with regards to speeding up lemon's generated parsers. If anyone has any questions, please feel free to ask. -sc


What is __fix_locale_grouping_str? It isn't used by lemon, as far as I am aware. And it does not appear in the bison profile. Getting rid of __fix_locale_grouping_str would be a big step towards improving the speed of lemon.

If you omit _fix_locale_grouping_str, then the time for lemon is
the time for Parse (1.52), yy_pop_parser_stack (0.20), yy_shift (0.13)
and yy_reduce (0.12) for a total of 1.97.  Bison is still faster at
1.50, but we are suddenly a lot closer.


-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to