Test Trac #10359
[ghc.git] / testsuite / tests / perf / should_run / all.T
1 # Tests that newArray/newArray_ is being optimised correctly
2
3 test('T10359',
4      [stats_num_field('bytes allocated',
5           [(wordsize(64), 499512, 5),
6            (wordsize(32), 250000, 5)]),
7       only_ways(['normal'])
8       ],
9      compile_and_run,
10      ['-O'])
11
12 # fortunately the values here are mostly independent of the wordsize,
13 # because the test allocates an unboxed array of doubles.
14 test('T3586',
15      [stats_num_field('peak_megabytes_allocated', (17, 1)),
16                                  # expected value: 17 (amd64/Linux)
17       stats_num_field('bytes allocated', (16102024, 5)),
18                         # prev:           16835544 (amd64/Linux)
19                         # 2014-07-17:     16102024 (amd64/Linux), general round of updates
20       only_ways(['normal'])
21       ],
22      compile_and_run,
23      ['-O'])
24
25 test('T4830',
26      [stats_num_field('bytes allocated',
27           [(wordsize(64), 98248, 4),
28            #             127000 (amd64/Linux)
29            # 2013-02-07:  99264 (amd64/Linux)
30            # 2014-01-13:  98248 (amd64/Linux) due to #8647
31            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
32            (wordsize(32), 70646, 3)]),
33            # 2013-02-10:  69744 (x86/Windows)
34            # 2013-02-10:  71548 (x86/OSX)
35            # 2014-01-28:  Widen range 2->3
36            #                (x86/Windows - actual 69000, lower was 69233)
37       only_ways(['normal'])
38       ],
39      compile_and_run,
40      ['-O2'])
41
42 test('T3245', normal, compile_and_run, ['-O'])
43
44 # Test that bytestring reading/writing isn't over-allocating.  We had
45 # a bug in hGetBufNonBlocking in 6.13 that triggered this.
46 #
47 test('lazy-bs-alloc',
48      [stats_num_field('peak_megabytes_allocated', (2, 1)),
49                                  # expected value: 2 (amd64/Linux)
50       stats_num_field('bytes allocated',
51           [(wordsize(64), 425400, 3),
52             #             489776 (amd64/Linux)
53             # 2013-02-07: 429744 (amd64/Linux)
54             # 2013-12-12: 425400 (amd64/Linux)
55             # 2015-04-04: Widen 1->3% (amd64/Windows was failing)
56            (wordsize(32), 411500, 2)]),
57             # 2013-02-10: 421296 (x86/Windows)
58             # 2013-02-10: 414180 (x86/OSX)
59             # 2014-01-22: 411500 (x86/Linux)
60             # 2014-01-28: Widen 1->2% (x86/Windows was at 425212)
61       only_ways(['normal']),
62       extra_run_opts('../../numeric/should_run/arith011.stdout'),
63       ignore_output
64       ],
65       # use a suitably big file, without bloating the repo with a new one:
66      compile_and_run,
67      ['-O'])
68
69 test('T876',
70      [stats_num_field('bytes allocated',
71           [(platform('x86_64-unknown-mingw32'), 71904, 5),
72               # 2015-04-03: 71904 (amd64/Windows, unknown cause)
73            (wordsize(64), 63216 , 5),
74               # 2013-02-14: 1263712 (x86_64/Linux)
75               # 2014-02-10:   63216 (x86_64/Linux), call arity analysis
76
77            (wordsize(32), 56796, 5) ]),
78               # some date:  663712  (Windows, 64-bit machine)
79               # 2014-04-04:  56820  (Windows, 64-bit machine)
80               # 2014-06-29:  53024  (x86_64/Linux)
81               # 2014-12-01:  56796  (Windows)
82
83       only_ways(['normal']),
84       extra_run_opts('10000')
85       ],
86      compile_and_run,
87      ['-O'])
88
89 # Get reproducible floating-point results on x86
90 if config.arch == 'i386':
91    sse2_opts = '-msse2'
92 else:
93    sse2_opts = ''
94
95 test('T4321',
96      omit_ways(['ghci']),
97      compile_and_run, ['-O ' + sse2_opts])
98
99 test('T3736',
100      extra_clean(['T3736.speed.f32']),
101      run_command,
102      ['$MAKE -s --no-print-directory T3736'])
103 test('T3738',
104      [extra_clean(['T3738a.hi', 'T3738a.o']),
105       stats_num_field('peak_megabytes_allocated', (1, 0)),
106                                  # expected value: 1 (amd64/Linux)
107       stats_num_field('bytes allocated',
108                       [(wordsize(32), 45648, 5),
109                     # expected value: 50520 (x86/Linux)
110                        (wordsize(64), 50592, 8)]),
111                     # prev:           49400 (amd64/Linux)
112                     # 2014-07-17:     50520 (amd64/Linux) general round of updates
113                     # 2014-09-10:     50592 (amd64/Linux) post-AMP-update
114                     # 2015-04-03: Widen 5->8% (amd64/Windows was doing better)
115       only_ways(['normal'])
116       ],
117      compile_and_run,
118      ['-O'])
119
120 test('MethSharing',
121      [stats_num_field('peak_megabytes_allocated', (1, 0)),
122                                  # expected value: 1 (amd64/Linux)
123       stats_num_field('bytes allocated',
124                       [(wordsize(32), 360940756, 5),
125                     # expected value: 2685858140 (x86/OS X)
126                           # expected: 360940756 (x86/Linux)
127                        (wordsize(64), 640067672, 5)]),
128                           # expected: 640067672 (amd64/Linux)
129       only_ways(['normal'])
130       ],
131      compile_and_run,
132      ['-O'])
133 test('T2902',
134      extra_clean(['T2902_A',    'T2902_B',
135                   'T2902_A.hi', 'T2902_B.hi',
136                   'T2902_A.o',  'T2902_B.o',
137                   'T2902_A_PairingSum.hi', 'T2902_B_PairingSum.hi',
138                   'T2902_A_PairingSum.o',  'T2902_B_PairingSum.o',
139                   'T2902_Sum.hi',
140                   'T2902_Sum.o']),
141      run_command,
142      ['$MAKE -s --no-print-directory T2902'])
143 test('T149',
144      [ # expect_broken(149),
145        # working (2 Jul 2013, x86-64/Linux)
146       extra_clean(['T149_A',    'T149_B',
147                    'T149_A.hi', 'T149_B.hi',
148                    'T149_A.o',  'T149_B.o'])],
149      run_command,
150      ['$MAKE -s --no-print-directory T149'])
151
152 test('T5113',
153      [stats_num_field('bytes allocated',
154                       [(wordsize(32), 4000000, 5),
155                        (wordsize(64), 8000000, 5)]),
156       only_ways(['normal'])
157       ],
158      compile_and_run,
159      ['-O'])
160
161
162 test('T4978',
163      [stats_num_field('bytes allocated',
164                       [(wordsize(32), 10000000, 5),
165                        (wordsize(64), 10137680, 5)]),
166                     # expected value: 10137680 (amd64/Linux)
167       only_ways(['normal'])
168       ],
169      compile_and_run,
170      ['-O2'])
171
172 test('T5205',
173      [stats_num_field('bytes allocated',
174                       [(wordsize(32), 47088, 5),
175                     # expected value: 47088 (x86/Darwin)
176                        (wordsize(64), 52600, 7)]),
177                     # expected value: 51320 (amd64/Linux)
178                     # 2014-07-17:     52600 (amd64/Linux) general round of updates
179                     # 2015-04-03: Widen 5->7% (amd64/Windows was doing better)
180       only_ways(['normal', 'optasm'])
181       ],
182      compile_and_run,
183      [''])
184
185 test('T5549',
186      [stats_num_field('bytes allocated',
187                       [(wordsize(32), 4096606332, 5),
188                     # expected value: 3362958676 (Windows)
189                     # 2014-12-01:     4096606332 (Windows) integer-gmp2
190
191                        (wordsize(64), 8193140752, 5)]),
192                     # expected value: 6725846120 (amd64/Linux)
193                     #                 8193140752 (amd64/Linux) integer-gmp2
194       only_ways(['normal'])
195       ],
196      compile_and_run,
197      ['-O'])
198
199 test('T4474a',
200      [stats_num_field('bytes allocated',
201                       [(wordsize(32), 2405242767, 5),
202                        (wordsize(64), 4831890304, 5)]),
203                     # expected value: 4831890304 (amd64/OSX)
204       only_ways(['normal'])
205       ],
206      compile_and_run,
207      ['-O'])
208 test('T4474b',
209      [stats_num_field('bytes allocated',
210                       [(wordsize(32), 2405242767, 5),
211                        (wordsize(64), 4831890304, 5)]),
212                     # expected value: 4831890304 (amd64/OSX)
213       only_ways(['normal'])
214       ],
215      compile_and_run,
216      ['-O'])
217 test('T4474c',
218      [stats_num_field('bytes allocated',
219                       [(wordsize(32), 2405242767, 5),
220                        (wordsize(64), 4831890304, 5)]),
221                     # expected value: 4831890304 (amd64/OSX)
222       only_ways(['normal'])
223       ],
224      compile_and_run,
225      ['-O'])
226
227 test('T5237',
228      [stats_num_field('bytes allocated',
229                         [(platform('i386-unknown-mingw32'), 73280, 5),
230                          (wordsize(32), 78328, 5),
231                       # expected value: 78328 (i386/Linux)
232                          (wordsize(64), 104176, 5)]),
233                       # expected value: 110888 (amd64/Linux)
234                       # expected value: 104176 (amd64/Linux)
235      only_ways(['normal'])
236      ],
237     compile_and_run,
238     ['-O ' + sse2_opts])
239
240 test('T5536',
241      [stats_num_field('bytes allocated',
242                       [(wordsize(32), 446260520, 1),
243                                    # 1246287228 (i386/Linux)
244                                     # 446328556 (i386/Windows)
245                                     # 446192484 (i386/OSX)
246                        (wordsize(64), 892399040, 5)]),
247                    # expected value: 2492589480 (amd64/Linux)
248                    # 17/1/13:         892399040 (x86_64/Linux)
249                    #                  (new demand analyser)
250      extra_clean(['T5536.data']),
251      ignore_output,
252      only_ways(['normal'])
253      ],
254     compile_and_run,
255     ['-O'])
256
257 test('T7257',
258      [stats_num_field('bytes allocated',
259                       [(wordsize(32), 1150000000, 10),
260                     # expected value: 1246287228 (i386/Linux)
261                        (wordsize(64), 1774893760, 5)]),
262                         # 2012-09-21: 1774893760 (amd64/Linux)
263       stats_num_field('peak_megabytes_allocated',
264                       [(wordsize(32), 217, 5),
265                         # 2012-10-08: 217 (x86/Linux)
266                        (wordsize(64), 227, 5)]),
267                         # 2012-09-21: 227 (amd64/Linux)
268
269       only_ways(['normal'])
270      ],
271     compile_and_run, ['-O'])
272
273 test('Conversions',
274      [stats_num_field('bytes allocated',
275                       [(wordsize(32), 76768, 3),
276                         # 2012-12-18: 55316 Guessed 64-bit value / 2
277                         # 2013-02-10: 77472 (x86/OSX)
278                         # 2013-02-10: 79276 (x86/Windows)
279                         # 2014-01-13: 76768 (x86/Linux) due to #8647
280                        (wordsize(64), 107544, 5)]),
281                         # 2012-12-18: 109608 (amd64/OS X)
282                         # 2014-07-17: 107544 (amd64/Linux)
283
284       only_ways(['normal'])
285      ],
286     compile_and_run, ['-O -msse2'])
287
288 test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
289 # For 7507, stack overflow is the bad case
290
291 test('T7436',
292      [stats_num_field('max_bytes_used',
293           [(wordsize(64), 60360, 4),
294            #             127000 (amd64/Linux)
295            # 2013-02-07:  60360 (amd64/Linux)
296            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
297            (wordsize(32), 58434, 1)]),
298             # 2013-02-10: 58032 (x86/Windows)
299             # 2013-02-10: 58836 (x86/OSX)
300       only_ways(['normal'])
301       ],
302      compile_and_run,
303      ['-O'])
304
305 test('T7797',
306       [stats_num_field('bytes allocated',
307                       [(wordsize(32), 240044984, 5),
308                           # expected value: 2685858140 (x86/OS X)
309                           # expected: 360940756 (x86/Linux)
310                           # expected: 240044984 (x86/Windows, 64bit machine)
311                        (wordsize(64), 480050944, 5)]),
312                           # expected: 480050944 (amd64/Linux)
313       extra_clean(['T7797a.hi', 'T7797a.o']),
314       only_ways(['normal'])
315       ],
316      compile_and_run,
317      ['-O'])
318
319 test('T7954',
320       [stats_num_field('bytes allocated',
321                       [(wordsize(32), 920045264, 10),
322               # some date:  1380051408    (64-bit Windows machine)
323               # 2014-04-04:  920045264    (64-bit Windows machine)
324                        (wordsize(64), 1680051336, 10)]),
325               # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis
326       only_ways(['normal'])
327       ],
328      compile_and_run,
329      ['-O'])
330
331 test('T7850',
332      [stats_num_field('peak_megabytes_allocated', 
333                       [(wordsize(32), 2, 10),
334                        (wordsize(64), 4, 10)]),
335       only_ways(['normal'])],
336      compile_and_run,
337      ['-O'])
338
339 test('T5949',
340      [stats_num_field('bytes allocated',
341                       [ (wordsize(32), 116020, 10),
342                         (wordsize(64), 201008, 10)]),
343                       # previously, it was >400000 bytes
344       only_ways(['normal'])],
345      compile_and_run,
346      ['-O'])
347
348 test('T4267',
349      [stats_num_field('bytes allocated',
350                       [ (wordsize(32), 36012, 10)
351                       # 32-bit value close to 64 bit; c.f. T7619
352                       , (wordsize(64), 40992, 10) ]),
353                       # previously, it was >170000 bytes
354                       # 2014-01-17: 130000
355                       # 2014-02-10: 40992 (x86_64/Linux), call arity analysis
356       only_ways(['normal'])],
357      compile_and_run,
358      ['-O'])
359
360 test('T7619',
361      [stats_num_field('bytes allocated',
362                       [ (wordsize(32), 36012, 10)
363                       # 32-bit close to 64-bit value; most of this very 
364                       # small number is standard start-up boilerplate I think
365                       , (wordsize(64), 40992, 10) ]),
366                       # previously, it was >400000 bytes
367       only_ways(['normal'])],
368      compile_and_run,
369      ['-O'])
370
371 test('InlineArrayAlloc',
372      [stats_num_field('bytes allocated',
373                       [ (wordsize(32), 800040960, 5)
374                       , (wordsize(64), 1600040960, 5) ]),
375       only_ways(['normal'])],
376      compile_and_run,
377      ['-O2'])
378
379 test('InlineByteArrayAlloc',
380      [stats_num_field('bytes allocated',
381                       [ (wordsize(32), 1360036012, 5)
382                       , (wordsize(64), 1440040960, 5) ]),
383          # 32 and 64 bit not so different, because 
384          # we are allocating *byte* arrays
385       only_ways(['normal'])],
386      compile_and_run,
387      ['-O2'])
388
389 test('InlineCloneArrayAlloc',
390      [stats_num_field('bytes allocated',
391                       [ (wordsize(32), 800041120, 5) 
392                       , (wordsize(64), 1600041120, 5) ]),
393       only_ways(['normal'])],
394      compile_and_run,
395      ['-O2'])
396
397 test('T9203',
398      [stats_num_field('bytes allocated',
399                       [ (wordsize(32), 50000000, 5)
400                       , (wordsize(64), 94547280, 5) ]),
401                       # was            95747304
402                       # 2019-09-10     94547280 post-AMP cleanup
403       only_ways(['normal'])],
404      compile_and_run,
405      ['-O2'])
406
407 test('T9339',
408      [stats_num_field('bytes allocated',
409                       [ (wordsize(32),    40046844, 5)
410                       , (wordsize(64),    80050760, 5) ]),
411                       # w/o fusing last: 320005080
412                       # 2014-07-22:       80050760
413       only_ways(['normal'])],
414      compile_and_run,
415      ['-O2'])