2 # Copyright (C) 2006, Parrot Foundation.
7 use lib qw( lib . ../lib ../../lib );
14 t/benchmark/benchmarks.t - test scripts in examples/benchmarks
18 prove t/benchmark/benchmarks.t
22 Called by 'make benchmark_tests'.
26 # Expected output from scripts in 'examples/benchmarks'.
27 # The expected out is needed for checking results with pir_output_is() and pir_output_like().
29 q{addit.pir} => qq(21001097.97\n),
30 q{addit.pasm} => qq(21001097.97\n),
31 q{addit2.pir} => qq(21001097.97\n),
32 q{array_access.pir} => qr/
33 1\s\*\s1000\s=\s1000\n
34 100\s\*\s1000\s=\s100000\n
35 FixedFloatArray:\s\d+\.\d+s\n
37 1\s\*\s1000\s=\s1000\n
38 100\s\*\s1000\s=\s100000\n
39 FixedIntegerArray:\s\d+\.\d+s\n
41 1\s\*\s1000\s=\s1000\n
42 100\s\*\s1000\s=\s100000\n
43 FixedPMCArray:\s\d+\.\d+s\n
45 1\s\*\s1000\s=\s1000\n
46 100\s\*\s1000\s=\s100000\n
47 FixedStringArray:\s\d+\.\d+s\n
49 1\s\*\s1000\s=\s1000\n
50 100\s\*\s1000\s=\s100000\n
51 ResizableFloatArray:\s\d+\.\d+s\n
53 1\s\*\s1000\s=\s1000\n
54 100\s\*\s1000\s=\s100000\n
55 ResizableIntegerArray:\s\d+\.\d+s\n
57 1\s\*\s1000\s=\s1000\n
58 100\s\*\s1000\s=\s100000\n
59 ResizablePMCArray:\s\d+\.\d+s\n
61 1\s\*\s1000\s=\s1000\n
62 100\s\*\s1000\s=\s100000\n
63 ResizableStringArray:\s\d+\.\d+s\n
65 1\s\*\s1000\s=\s1000\n
66 100\s\*\s1000\s=\s100000\n
67 FixedPMCArray:\s\d+\.\d+s\n
69 q{arriter.pir} => qq(100000\n100000\n100000\n111111\n),
70 q{arriter_o1.pir} => qq(100000\n100000\n100000\n111111\n),
71 q{bench_newp.pasm} => qr/^\d+\.\d+\sseconds.\s\d+\.\d+\sloops\/sec\n
72 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
73 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
74 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
75 Copying\sa\stotal\sof\s\d+\sbytes\n
76 There\sare\s\d+\sactive\sPMC\sstructs\n
77 There\sare\s\d+\stotal\sPMC\sstructs\n
78 There\sare\s\d+\sactive\sBuffer\sstructs\n
79 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
80 q{fib.pir} => qr/^fib\(28\)\s=\s317811\s\d+\.\d+s$/x,
81 q{freeze.pasm} => qr/^constr.time\s\d+\.\d+\n
82 freeze\stime\s\d+\.\d+\n
83 \s\sthaw\stime\s\d+\.\d+\n
85 ResizablePMCArray\s100000\n$/x,
86 q{gc_alloc_new.pasm} => qr/^\d+\.\d+\sseconds\.\n
87 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
88 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
89 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
90 Copying\sa\stotal\sof\s\d+\sbytes\n
91 There\sare\s\d+\sactive\sBuffer\sstructs\n
92 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
93 q{gc_alloc_reuse.pasm} => qr/^\d+\.\d+\sseconds\.\n
94 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
95 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
96 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
97 Copying\sa\stotal\sof\s\d+\sbytes\n
98 There\sare\s\d+\sactive\sBuffer\sstructs\n
99 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
100 q{gc_generations.pasm} => qr/^\d+\.\d+\sseconds\.\n
101 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
102 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
103 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
104 Copying\sa\stotal\sof\s\d+\sbytes\n
105 There\sare\s\d+\sactive\sBuffer\sstructs\n
106 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
107 q{gc_header_new.pasm} => qr/^\d+\.\d+\sseconds\.\n
108 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
109 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
110 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
111 Copying\sa\stotal\sof\s\d+\sbytes\n
112 There\sare\s\d+\sactive\sBuffer\sstructs\n
113 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
114 q{gc_header_reuse.pasm} => qr/^\d+\.\d+\sseconds\.\n
115 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
116 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
117 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
118 Copying\sa\stotal\sof\s\d+\sbytes\n
119 There\sare\s\d+\sactive\sBuffer\sstructs\n
120 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
121 q{gc_waves_headers.pasm} => qr/^\d+\.\d+\sseconds\.\n
122 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
123 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
124 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
125 Copying\sa\stotal\sof\s\d+\sbytes\n
126 There\sare\s\d+\sactive\sBuffer\sstructs\n
127 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
128 q{gc_waves_sizeable_data.pasm} => qr/^\d+\.\d+\sseconds\.\n
129 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
130 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
131 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
132 Copying\sa\stotal\sof\s\d+\sbytes\n
133 There\sare\s\d+\sactive\sBuffer\sstructs\n
134 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
135 q{gc_waves_sizeable_headers.pasm} => qr/^\d+\.\d+\sseconds\.\n
136 A\stotal\sof\s\d+\sbytes\swere\sallocated\n
137 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
138 A\stotal\sof\s\d+\scollection\sruns\swere\smade\n
139 Copying\sa\stotal\sof\s\d+\sbytes\n
140 There\sare\s\d+\sactive\sBuffer\sstructs\n
141 There\sare\s\d+\stotal\sBuffer\sstructs\n$/x,
142 #omitted because they're slow and doesn't exercise anything novel
143 # q{mops.pasm} => qr/^Iterations:\s\s\s\s10000000\n
144 # Estimated\sops:\s20000000\n
146 # Elapsed\stime:\s\s\d+\.\d+\n
147 # M\sop\/s:\s\s\s\s\s\s\s\s\d+\.\d+\n$/x,
148 # q(mops_intval.pasm) => qr/^Iterations:\s\s\s\s100000000\n
149 # Estimated\sops:\s200000000\n
150 # Elapsed\stime:\s\s\d+\.\d+\n
151 # M\sop\/s:\s\s\s\s\s\s\s\s\d+\.\d+\n$/x,
152 q{oo1.pir} => qq(10\n),
153 q{oo2.pir} => qq(10\n),
154 q{oo3.pir} => qq(10\n),
155 q{oo4.pasm} => qq(500000\n),
156 q{oo5.pir} => qq(10\n),
157 q{oo6.pir} => qq(500000\n),
158 q{oofib.pir} => qr/^fib\(24\)\s=\s46368\s\d+\.\d+s$/x,
159 q{overload.pir} => qq(42\n),
160 q{primes.pasm} => qr/^N\sprimes\sup\sto\s5000\sis:\s669\n
162 Elapsed\stime:\s\d+\.\d+\n$/x,
163 q{primes2.pir} => qr/^N\sprimes\scalculated\sto\s500\sis\s96\n
165 q{primes2_i.pir} => qr/^N\sprimes\scalculated\sto\s10000\s
166 is\s1230\nlast\sis:\s9973\n$/x,
167 q{primes_i.pasm} => qr/^N\sprimes\sup\sto\s10000\sis:\s1229\n
168 last\sis:\s9973\nElapsed\stime:\s\d+\.\d+\n$/x,
169 q{stress.pasm} => qr/^A\stotal\sof\s\d+\sGC\sruns\s
171 q{stress1.pasm} => qr/^\d+\.\d+\n
172 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
174 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
176 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
178 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
180 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
182 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
184 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
186 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
188 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
190 A\stotal\sof\s\d+\sGC\sruns\swere\smade\n$/x,
191 q{stress2.pasm} => qq(),
192 q{stress3.pasm} => qr/^A\stotal\sof\s\d+\sGC\sruns\swere\smade\n
194 \d+\stotal\s\sPMCs\n$/x,
195 q{vpm.pir} => qq(100000;\nl hackerjust another per\n)
198 # These scripts are known to be failing.
201 plan tests => scalar keys %outputs;
203 foreach ( sort keys %outputs ) {
205 my $bench = Parrot::Test::slurp_file("examples/benchmarks/$_");
206 skip( "Could not slurp $_", 1 ) unless $bench;
208 my @todo = $todo{$_} ? ( todo => $todo{$_} ) : ();
210 if ( ref $outputs{$_} eq 'Regexp' ) {
211 example_output_like( "examples/benchmarks/$_", $outputs{$_}, @todo );
214 example_output_is( "examples/benchmarks/$_", $outputs{$_}, @todo );
221 # cperl-indent-level: 4
224 # vim: expandtab shiftwidth=4: