On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote:
> Bob,
>
> I'm starting to toy with your implementation, and to try to bench it.
> It seems that there is about a 15% performance loss of push.c compared
> to yacc.c, both used in pull mode without compiler optimization on my
> Mac.
Does the attached gprof info tell you anything? I only ran each case
once to get the gprof file.
Bob Rossi
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the number of times this function was invoked, if
this function is profiled, else blank.
self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.
total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.
name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.
yacc-yacc
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
72.35 1.57 1.57 1 1.57 2.17 yyparse
12.44 1.84 0.27 1240401 0.00 0.00 yylex
8.29 2.02 0.18 420200 0.00 0.00 read_signed_integer
3.46 2.10 0.07 2856601 0.00 0.00 get_char
3.46 2.17 0.07 840400 0.00 0.00 unget_char
0.00 2.17 0.00 1 0.00 0.00 yydestruct
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 0.46% of 2.17 seconds
index % time self children called name
1.57 0.60 1/1 main [2]
[1] 100.0 1.57 0.60 1 yyparse [1]
0.27 0.33 1240401/1240401 yylex [3]
0.00 0.00 1/1 yydestruct [7]
-----------------------------------------------
<spontaneous>
[2] 100.0 0.00 2.17 main [2]
1.57 0.60 1/1 yyparse [1]
-----------------------------------------------
0.27 0.33 1240401/1240401 yyparse [1]
[3] 27.6 0.27 0.33 1240401 yylex [3]
0.18 0.08 420200/420200 read_signed_integer [4]
0.04 0.00 420200/840400 unget_char [6]
0.03 0.00 1240401/2856601 get_char [5]
-----------------------------------------------
0.18 0.08 420200/420200 yylex [3]
[4] 12.0 0.18 0.08 420200 read_signed_integer [4]
0.04 0.00 1616200/2856601 get_char [5]
0.04 0.00 420200/840400 unget_char [6]
-----------------------------------------------
0.03 0.00 1240401/2856601 yylex [3]
0.04 0.00 1616200/2856601 read_signed_integer [4]
[5] 3.5 0.07 0.00 2856601 get_char [5]
-----------------------------------------------
0.04 0.00 420200/840400 read_signed_integer [4]
0.04 0.00 420200/840400 yylex [3]
[6] 3.5 0.07 0.00 840400 unget_char [6]
-----------------------------------------------
0.00 0.00 1/1 yyparse [1]
[7] 0.0 0.00 0.00 1 yydestruct [7]
-----------------------------------------------
yacc-pure
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
62.98 1.48 1.48 1 1.48 2.24 yyparse
12.98 1.78 0.30 1240401 0.00 0.00 yylex
10.00 2.02 0.23 420200 0.00 0.00 read_signed_integer
8.09 2.21 0.19 2856601 0.00 0.00 get_char
3.40 2.29 0.08 yyerror
1.28 2.32 0.03 840400 0.00 0.00 unget_char
1.28 2.35 0.03 power
0.00 2.35 0.00 1 0.00 0.00 yydestruct
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 0.43% of 2.35 seconds
index % time self children called name
1.48 0.76 1/1 main [2]
[1] 95.3 1.48 0.76 1 yyparse [1]
0.30 0.46 1240401/1240401 yylex [3]
0.00 0.00 1/1 yydestruct [9]
-----------------------------------------------
<spontaneous>
[2] 95.3 0.00 2.24 main [2]
1.48 0.76 1/1 yyparse [1]
-----------------------------------------------
0.30 0.46 1240401/1240401 yyparse [1]
[3] 32.3 0.30 0.46 1240401 yylex [3]
0.23 0.12 420200/420200 read_signed_integer [4]
0.08 0.00 1240401/2856601 get_char [5]
0.01 0.00 420200/840400 unget_char [7]
-----------------------------------------------
0.23 0.12 420200/420200 yylex [3]
[4] 15.2 0.23 0.12 420200 read_signed_integer [4]
0.11 0.00 1616200/2856601 get_char [5]
0.01 0.00 420200/840400 unget_char [7]
-----------------------------------------------
0.08 0.00 1240401/2856601 yylex [3]
0.11 0.00 1616200/2856601 read_signed_integer [4]
[5] 8.1 0.19 0.00 2856601 get_char [5]
-----------------------------------------------
<spontaneous>
[6] 3.4 0.08 0.00 yyerror [6]
-----------------------------------------------
0.01 0.00 420200/840400 read_signed_integer [4]
0.01 0.00 420200/840400 yylex [3]
[7] 1.3 0.03 0.00 840400 unget_char [7]
-----------------------------------------------
<spontaneous>
[8] 1.3 0.03 0.00 power [8]
-----------------------------------------------
0.00 0.00 1/1 yyparse [1]
[9] 0.0 0.00 0.00 1 yydestruct [9]
-----------------------------------------------
push-yacc
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
79.09 3.29 3.29 1 3.29 4.06 yyparse
6.25 3.55 0.26 2856601 0.00 0.00 get_char
5.89 3.79 0.24 420200 0.00 0.00 read_signed_integer
4.93 4.00 0.20 1240401 0.00 0.00 yylex
1.92 4.08 0.08 yyerror
1.44 4.14 0.06 840400 0.00 0.00 unget_char
0.48 4.16 0.02 power
0.00 4.16 0.00 1 0.00 0.00 yydestruct
0.00 4.16 0.00 1 0.00 0.00 yypvarsinit
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 0.24% of 4.16 seconds
index % time self children called name
3.29 0.77 1/1 main [2]
[1] 97.6 3.29 0.77 1 yyparse [1]
0.20 0.56 1240401/1240401 yylex [3]
0.00 0.00 1/1 yypvarsinit [10]
0.00 0.00 1/1 yydestruct [9]
-----------------------------------------------
<spontaneous>
[2] 97.6 0.00 4.06 main [2]
3.29 0.77 1/1 yyparse [1]
-----------------------------------------------
0.20 0.56 1240401/1240401 yyparse [1]
[3] 18.5 0.20 0.56 1240401 yylex [3]
0.24 0.18 420200/420200 read_signed_integer [4]
0.11 0.00 1240401/2856601 get_char [5]
0.03 0.00 420200/840400 unget_char [7]
-----------------------------------------------
0.24 0.18 420200/420200 yylex [3]
[4] 10.1 0.24 0.18 420200 read_signed_integer [4]
0.15 0.00 1616200/2856601 get_char [5]
0.03 0.00 420200/840400 unget_char [7]
-----------------------------------------------
0.11 0.00 1240401/2856601 yylex [3]
0.15 0.00 1616200/2856601 read_signed_integer [4]
[5] 6.2 0.26 0.00 2856601 get_char [5]
-----------------------------------------------
<spontaneous>
[6] 1.9 0.08 0.00 yyerror [6]
-----------------------------------------------
0.03 0.00 420200/840400 read_signed_integer [4]
0.03 0.00 420200/840400 yylex [3]
[7] 1.4 0.06 0.00 840400 unget_char [7]
-----------------------------------------------
<spontaneous>
[8] 0.5 0.02 0.00 power [8]
-----------------------------------------------
0.00 0.00 1/1 yyparse [1]
[9] 0.0 0.00 0.00 1 yydestruct [9]
-----------------------------------------------
0.00 0.00 1/1 yyparse [1]
[10] 0.0 0.00 0.00 1 yypvarsinit [10]
-----------------------------------------------
push-push
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
71.79 2.69 2.69 1240402 0.00 0.00 yyparse
9.22 3.03 0.34 1240402 0.00 0.00 yylex
7.62 3.31 0.28 420200 0.00 0.00 read_signed_integer
3.61 3.45 0.14 2856602 0.00 0.00 get_char
2.94 3.56 0.11 1 0.11 3.71 yyparse_wrapper
2.14 3.64 0.08 1240402 0.00 0.00 get_yyresult
1.20 3.69 0.04 1240402 0.00 0.00 set_yychar
0.67 3.71 0.03 yyerror
0.53 3.73 0.02 840400 0.00 0.00 unget_char
0.27 3.74 0.01 power
0.00 3.74 0.00 1 0.00 0.00 yydestruct
0.00 3.74 0.00 1 0.00 0.00 yypvarsinit
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 0.27% of 3.74 seconds
index % time self children called name
0.11 3.60 1/1 main [2]
[1] 99.1 0.11 3.60 1 yyparse_wrapper [1]
2.69 0.00 1240402/1240402 yyparse [3]
0.34 0.44 1240402/1240402 yylex [4]
0.08 0.00 1240402/1240402 get_yyresult [7]
0.04 0.00 1240402/1240402 set_yychar [8]
0.00 0.00 1/1 yypvarsinit [13]
-----------------------------------------------
<spontaneous>
[2] 99.1 0.00 3.71 main [2]
0.11 3.60 1/1 yyparse_wrapper [1]
-----------------------------------------------
2.69 0.00 1240402/1240402 yyparse_wrapper [1]
[3] 71.8 2.69 0.00 1240402 yyparse [3]
0.00 0.00 1/1 yydestruct [12]
-----------------------------------------------
0.34 0.44 1240402/1240402 yyparse_wrapper [1]
[4] 21.0 0.34 0.44 1240402 yylex [4]
0.28 0.09 420200/420200 read_signed_integer [5]
0.06 0.00 1240402/2856602 get_char [6]
0.01 0.00 420200/840400 unget_char [10]
-----------------------------------------------
0.28 0.09 420200/420200 yylex [4]
[5] 9.9 0.28 0.09 420200 read_signed_integer [5]
0.08 0.00 1616200/2856602 get_char [6]
0.01 0.00 420200/840400 unget_char [10]
-----------------------------------------------
0.06 0.00 1240402/2856602 yylex [4]
0.08 0.00 1616200/2856602 read_signed_integer [5]
[6] 3.6 0.14 0.00 2856602 get_char [6]
-----------------------------------------------
0.08 0.00 1240402/1240402 yyparse_wrapper [1]
[7] 2.1 0.08 0.00 1240402 get_yyresult [7]
-----------------------------------------------
0.04 0.00 1240402/1240402 yyparse_wrapper [1]
[8] 1.2 0.04 0.00 1240402 set_yychar [8]
-----------------------------------------------
<spontaneous>
[9] 0.7 0.03 0.00 yyerror [9]
-----------------------------------------------
0.01 0.00 420200/840400 read_signed_integer [5]
0.01 0.00 420200/840400 yylex [4]
[10] 0.5 0.02 0.00 840400 unget_char [10]
-----------------------------------------------
<spontaneous>
[11] 0.3 0.01 0.00 power [11]
-----------------------------------------------
0.00 0.00 1/1 yyparse [3]
[12] 0.0 0.00 0.00 1 yydestruct [12]
-----------------------------------------------
0.00 0.00 1/1 yyparse_wrapper [1]
[13] 0.0 0.00 0.00 1 yypvarsinit [13]
-----------------------------------------------
push-pure
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
77.78 2.80 2.80 1 2.80 3.60 yyparse
8.06 3.09 0.29 2856601 0.00 0.00 get_char
7.36 3.35 0.27 1240401 0.00 0.00 yylex
5.28 3.54 0.19 420200 0.00 0.00 read_signed_integer
1.39 3.60 0.05 840400 0.00 0.00 unget_char
0.14 3.60 0.01 power
0.00 3.60 0.00 1 0.00 0.00 yydestruct
0.00 3.60 0.00 1 0.00 0.00 yypvarsinit
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 0.28% of 3.60 seconds
index % time self children called name
2.80 0.80 1/1 main [2]
[1] 99.9 2.80 0.80 1 yyparse [1]
0.27 0.53 1240401/1240401 yylex [3]
0.00 0.00 1/1 yypvarsinit [9]
0.00 0.00 1/1 yydestruct [8]
-----------------------------------------------
<spontaneous>
[2] 99.9 0.00 3.60 main [2]
2.80 0.80 1/1 yyparse [1]
-----------------------------------------------
0.27 0.53 1240401/1240401 yyparse [1]
[3] 22.1 0.27 0.53 1240401 yylex [3]
0.19 0.19 420200/420200 read_signed_integer [4]
0.13 0.00 1240401/2856601 get_char [5]
0.03 0.00 420200/840400 unget_char [6]
-----------------------------------------------
0.19 0.19 420200/420200 yylex [3]
[4] 10.5 0.19 0.19 420200 read_signed_integer [4]
0.16 0.00 1616200/2856601 get_char [5]
0.03 0.00 420200/840400 unget_char [6]
-----------------------------------------------
0.13 0.00 1240401/2856601 yylex [3]
0.16 0.00 1616200/2856601 read_signed_integer [4]
[5] 8.1 0.29 0.00 2856601 get_char [5]
-----------------------------------------------
0.03 0.00 420200/840400 read_signed_integer [4]
0.03 0.00 420200/840400 yylex [3]
[6] 1.4 0.05 0.00 840400 unget_char [6]
-----------------------------------------------
<spontaneous>
[7] 0.1 0.01 0.00 power [7]
-----------------------------------------------
0.00 0.00 1/1 yyparse [1]
[8] 0.0 0.00 0.00 1 yydestruct [8]
-----------------------------------------------
0.00 0.00 1/1 yyparse [1]
[9] 0.0 0.00 0.00 1 yypvarsinit [9]
-----------------------------------------------