1560e7ea2e25d481ef5f4b382214659a53e08486
[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), 351508, 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       # Use `+RTS -G1` for more stable residency measurements. Note [residency].
23       # Only 64-bit as we don't have a good 32-bit test environment at the moment
24       when(wordsize(64), extra_hc_opts('+RTS -G1 -RTS'))
25       ],
26      compile_and_run,
27      ['-O'])
28
29 test('T4830',
30      [stats_num_field('bytes allocated',
31           [(wordsize(64), 98248, 4),
32            #             127000 (amd64/Linux)
33            # 2013-02-07:  99264 (amd64/Linux)
34            # 2014-01-13:  98248 (amd64/Linux) due to #8647
35            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
36            (wordsize(32), 70646, 3)]),
37            # 2013-02-10:  69744 (x86/Windows)
38            # 2013-02-10:  71548 (x86/OSX)
39            # 2014-01-28:  Widen range 2->3
40            #                (x86/Windows - actual 69000, lower was 69233)
41       only_ways(['normal'])
42       ],
43      compile_and_run,
44      ['-O2'])
45
46 test('T3245', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
47      compile_and_run, ['-O'])
48
49 # Test that bytestring reading/writing isn't over-allocating.  We had
50 # a bug in hGetBufNonBlocking in 6.13 that triggered this.
51 #
52 test('lazy-bs-alloc',
53      [stats_num_field('peak_megabytes_allocated', (2, 1)),
54                                  # expected value: 2 (amd64/Linux)
55       stats_num_field('bytes allocated',
56           [(wordsize(64), 444720, 5),
57             #             489776 (amd64/Linux)
58             # 2013-02-07: 429744 (amd64/Linux)
59             # 2013-12-12: 425400 (amd64/Linux)
60             # 2015-04-04: Widen 1->3% (amd64/Windows was failing)
61             # 2015-08-15: 431500 (Windows not good enough. avg of Windows&Linux)
62             # 2015-12-15: 444720 (amd64/Linux, D1616)
63             # 2015-12-17: 444720 (widen 3->5%, Windows is at 462688)
64            (wordsize(32), 429760, 2)]),
65             # 2013-02-10: 421296 (x86/Windows)
66             # 2013-02-10: 414180 (x86/OSX)
67             # 2014-01-22: 411500 (x86/Linux)
68             # 2014-01-28: Widen 1->2% (x86/Windows was at 425212)
69             # 2016-04-06: 429760 (x86/Linux) no idea what happened
70       only_ways(['normal']),
71       extra_run_opts('arith011.stdout'),
72       ignore_stdout,
73
74       # Use `+RTS -G1` for more stable residency measurements. Note [residency].
75       # Only 64-bit as we don't have a good 32-bit test environment at the moment
76       when(wordsize(64), extra_hc_opts('+RTS -G1 -RTS'))
77       ],
78      # use a suitably big file, without bloating the repo with a new one:
79      compile_and_run,
80      ['-O'])
81
82 test('T876',
83      [stats_num_field('bytes allocated',
84           [(platform('x86_64-unknown-mingw32'), 66928, 5),
85               # 2015-04-03: 71904 (amd64/Windows, unknown cause)
86               # 2016-11-27: 66928 (amd64/Windows, unknown cause)
87            (wordsize(64), 58128, 5),
88               # 2013-02-14: 1263712 (x86_64/Linux)
89               # 2014-02-10:   63216 (x86_64/Linux), call arity analysis
90               # 2016-11-11:   58128 (x86_64/Linux), it's not clear
91
92            (wordsize(32), 53156, 5) ]),
93               # some date:  663712  (Windows, 64-bit machine)
94               # 2014-04-04:  56820  (Windows, 64-bit machine)
95               # 2014-06-29:  53024  (x86_64/Linux)
96               # 2014-12-01:  56796  (Windows)
97               # 2015-07-11:  53156  (x86_64/Linux)
98
99       only_ways(['normal']),
100       extra_run_opts('10000')
101       ],
102      compile_and_run,
103      ['-O'])
104
105 # Get reproducible floating-point results on x86
106 if config.arch == 'i386':
107    sse2_opts = '-msse2'
108 else:
109    sse2_opts = ''
110
111 test('T4321',
112      omit_ways(['ghci']),
113      compile_and_run, ['-O ' + sse2_opts])
114
115 test('T3736',
116      extra_clean(['T3736.speed.f32']),
117      run_command,
118      ['$MAKE -s --no-print-directory T3736'])
119 test('T3738',
120      [extra_clean(['T3738a.hi', 'T3738a.o']),
121       stats_num_field('peak_megabytes_allocated', (2, 0)),
122                     # expected value: 1 (amd64/Linux)
123                     # 2016-08-31:     2 (allocation area size bumped to 1MB)
124       stats_num_field('bytes allocated',
125                       [(wordsize(32), 45648, 5),
126                     # expected value: 50520 (x86/Linux)
127                        (wordsize(64), 50592, 8)]),
128                     # prev:           49400 (amd64/Linux)
129                     # 2014-07-17:     50520 (amd64/Linux) general round of updates
130                     # 2014-09-10:     50592 (amd64/Linux) post-AMP-update
131                     # 2015-04-03: Widen 5->8% (amd64/Windows was doing better)
132       only_ways(['normal'])
133       ],
134      compile_and_run,
135      ['-O'])
136
137 test('MethSharing',
138      [stats_num_field('peak_megabytes_allocated', (2, 0)),
139                     # expected value: 1 (amd64/Linux)
140                     # 2016-08-31:     2 (allocation area size bumped to 1MB)
141       stats_num_field('bytes allocated',
142                       [(wordsize(32), 360940756, 5),
143                     # expected value: 2685858140 (x86/OS X)
144                           # expected: 360940756 (x86/Linux)
145                        (wordsize(64), 640067672, 5)]),
146                           # expected: 640067672 (amd64/Linux)
147       only_ways(['normal'])
148       ],
149      compile_and_run,
150      ['-O'])
151 test('T2902',
152      extra_clean(['T2902_A',    'T2902_B',
153                   'T2902_A.hi', 'T2902_B.hi',
154                   'T2902_A.o',  'T2902_B.o',
155                   'T2902_A_PairingSum.hi', 'T2902_B_PairingSum.hi',
156                   'T2902_A_PairingSum.o',  'T2902_B_PairingSum.o',
157                   'T2902_Sum.hi',
158                   'T2902_Sum.o']),
159      run_command,
160      ['$MAKE -s --no-print-directory T2902'])
161 test('T149',
162      [ # expect_broken(149),
163        # working (2 Jul 2013, x86-64/Linux)
164       extra_clean(['T149_A',    'T149_B',
165                    'T149_A.hi', 'T149_B.hi',
166                    'T149_A.o',  'T149_B.o'])],
167      run_command,
168      ['$MAKE -s --no-print-directory T149'])
169
170 test('T5113',
171      [stats_num_field('bytes allocated',
172                       [(wordsize(32), 4000000, 5),
173                        (wordsize(64), 8000000, 5)]),
174       only_ways(['normal'])
175       ],
176      compile_and_run,
177      ['-O'])
178
179
180 test('T4978',
181      [stats_num_field('bytes allocated',
182                       [(wordsize(32), 10000000, 5),
183                        (wordsize(64), 10137680, 5)]),
184                     # expected value: 10137680 (amd64/Linux)
185       only_ways(['normal'])
186       ],
187      compile_and_run,
188      ['-O2'])
189
190 test('T5205',
191      [stats_num_field('bytes allocated',
192                       [(wordsize(32), 47088, 5),
193                     # expected value: 47088 (x86/Darwin)
194
195                        (platform('x86_64-unknown-mingw32'), 52264, 5),
196                     # 2016-12-14: 52264 (Separate out Windows results)
197
198                        (wordsize(64), 56208, 5)]),
199                     # expected value: 51320 (amd64/Linux)
200                     # 2014-07-17:     52600 (amd64/Linux) general round of updates
201                     # 2015-04-03: Widen 5->7% (amd64/Windows was doing better)
202                     # 2015-08-15: 50648 (Windows too good. avg of Windows&Linux)
203                     # 2015-10-30: 56208 (D757: Emit Typeable at definition site)
204                     # 2016-12-14: Narrow 7->5% (Separate out Windows results)
205       only_ways(['normal', 'optasm'])
206       ],
207      compile_and_run,
208      [''])
209
210 test('T5549',
211      [stats_num_field('bytes allocated',
212                       [(wordsize(32), 4096606332, 5),
213                     # expected value: 3362958676 (Windows)
214                     # 2014-12-01:     4096606332 (Windows) integer-gmp2
215
216                        (wordsize(64), 5793140200, 5)]),
217                     # expected value: 6725846120 (amd64/Linux)
218                     #                 8193140752 (amd64/Linux) integer-gmp2
219                     #                 5793140200 (amd64/Linux) integer-gmp2
220       only_ways(['normal'])
221       ],
222      compile_and_run,
223      ['-O'])
224
225 test('T4474a',
226      [stats_num_field('bytes allocated',
227                       [(wordsize(32), 2405242767, 5),
228                        (wordsize(64), 4831890304, 5)]),
229                     # expected value: 4831890304 (amd64/OSX)
230       only_ways(['normal'])
231       ],
232      compile_and_run,
233      ['-O'])
234 test('T4474b',
235      [stats_num_field('bytes allocated',
236                       [(wordsize(32), 2405242767, 5),
237                        (wordsize(64), 4831890304, 5)]),
238                     # expected value: 4831890304 (amd64/OSX)
239       only_ways(['normal'])
240       ],
241      compile_and_run,
242      ['-O'])
243 test('T4474c',
244      [stats_num_field('bytes allocated',
245                       [(wordsize(32), 2405242767, 5),
246                        (wordsize(64), 4831890304, 5)]),
247                     # expected value: 4831890304 (amd64/OSX)
248       only_ways(['normal'])
249       ],
250      compile_and_run,
251      ['-O'])
252
253 test('T5237',
254      [stats_num_field('bytes allocated',
255                         [(platform('i386-unknown-mingw32'), 73280, 5),
256                          (wordsize(32), 78328, 5),
257                       # expected value: 78328 (i386/Linux)
258                          (wordsize(64), 104176, 5)]),
259                       # expected value: 110888 (amd64/Linux)
260                       # expected value: 104176 (amd64/Linux)
261      only_ways(['normal'])
262      ],
263     compile_and_run,
264     ['-O ' + sse2_opts])
265
266 test('T5536',
267      [stats_num_field('bytes allocated',
268                       [(wordsize(32), 446260520, 1),
269                                    # 1246287228 (i386/Linux)
270                                     # 446328556 (i386/Windows)
271                                     # 446192484 (i386/OSX)
272                        (wordsize(64), 892399040, 5)]),
273                    # expected value: 2492589480 (amd64/Linux)
274                    # 17/1/13:         892399040 (x86_64/Linux)
275                    #                  (new demand analyser)
276      extra_clean(['T5536.data']),
277      ignore_stdout,
278      only_ways(['normal'])
279      ],
280     compile_and_run,
281     ['-O'])
282
283 test('T7257',
284      [stats_num_field('bytes allocated',
285                       [(wordsize(32), 989850664, 10),
286                         # expected value: 1246287228 (i386/Linux)
287                         # 2016-04-06: 989850664 (i386/Linux) no idea what happened
288                        (wordsize(64), 1414893248, 5)]),
289                         # 2012-09-21: 1774893760 (amd64/Linux)
290                         # 2015-11-03: 1654893248 (amd64/Linux)
291                         # 2016-06-22: 1414893248 (amd64/Linux, sizeExpr fix)
292       stats_num_field('peak_megabytes_allocated',
293                       [(wordsize(32), 217, 5),
294                         # 2012-10-08: 217 (x86/Linux)
295                        (wordsize(64), 227, 5)]),
296                         # 2012-09-21: 227 (amd64/Linux)
297
298       only_ways(['normal'])
299      ],
300     compile_and_run, ['-O'])
301
302 test('Conversions',
303      [stats_num_field('bytes allocated',
304                       [(wordsize(32), 76768, 3),
305                         # 2012-12-18: 55316 Guessed 64-bit value / 2
306                         # 2013-02-10: 77472 (x86/OSX)
307                         # 2013-02-10: 79276 (x86/Windows)
308                         # 2014-01-13: 76768 (x86/Linux) due to #8647
309                        (wordsize(64), 107544, 5)]),
310                         # 2012-12-18: 109608 (amd64/OS X)
311                         # 2014-07-17: 107544 (amd64/Linux)
312
313       only_ways(['normal'])
314      ],
315     compile_and_run, ['-O -msse2'])
316
317 test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
318 # For 7507, stack overflow is the bad case
319
320 test('T7436',
321      [stats_num_field('max_bytes_used',
322           [(wordsize(64), 60360, 4),
323            #             127000 (amd64/Linux)
324            # 2013-02-07:  60360 (amd64/Linux)
325            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
326            (wordsize(32), 58434, 1)]),
327             # 2013-02-10: 58032 (x86/Windows)
328             # 2013-02-10: 58836 (x86/OSX)
329       only_ways(['normal'])
330       ],
331      compile_and_run,
332      ['-O'])
333
334 test('T7797',
335       [stats_num_field('bytes allocated',
336                       [(wordsize(32), 240044984, 5),
337                           # expected value: 2685858140 (x86/OS X)
338                           # expected: 360940756 (x86/Linux)
339                           # expected: 240044984 (x86/Windows, 64bit machine)
340                        (wordsize(64), 480050944, 5)]),
341                           # expected: 480050944 (amd64/Linux)
342       extra_clean(['T7797a.hi', 'T7797a.o']),
343       only_ways(['normal'])
344       ],
345      compile_and_run,
346      ['-O'])
347
348 test('T7954',
349       [stats_num_field('bytes allocated',
350                       [(wordsize(32), 920045264, 10),
351               # some date:  1380051408    (64-bit Windows machine)
352               # 2014-04-04:  920045264    (64-bit Windows machine)
353                        (wordsize(64), 1680051336, 10)]),
354               # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis
355       only_ways(['normal'])
356       ],
357      compile_and_run,
358      ['-O'])
359
360 test('T7850',
361      [stats_num_field('peak_megabytes_allocated', 
362                       [(wordsize(32), 2, 10),
363                        (wordsize(64), 4, 10)]),
364       only_ways(['normal'])],
365      compile_and_run,
366      ['-O'])
367
368 test('T5949',
369      [stats_num_field('bytes allocated',
370                       [ (wordsize(32), 116020, 10),
371                         (wordsize(64), 201008, 10)]),
372                       # previously, it was >400000 bytes
373       only_ways(['normal'])],
374      compile_and_run,
375      ['-O'])
376
377 test('T4267',
378      [stats_num_field('bytes allocated',
379                       [ (wordsize(32), 36012, 10)
380                       # 32-bit value close to 64 bit; c.f. T7619
381                       , (wordsize(64), 40992, 10) ]),
382                       # previously, it was >170000 bytes
383                       # 2014-01-17: 130000
384                       # 2014-02-10: 40992 (x86_64/Linux), call arity analysis
385       only_ways(['normal'])],
386      compile_and_run,
387      ['-O'])
388
389 test('T7619',
390      [stats_num_field('bytes allocated',
391                       [ (wordsize(32), 36012, 10)
392                       # 32-bit close to 64-bit value; most of this very 
393                       # small number is standard start-up boilerplate I think
394                       , (wordsize(64), 40992, 10) ]),
395                       # previously, it was >400000 bytes
396       only_ways(['normal'])],
397      compile_and_run,
398      ['-O'])
399
400 test('InlineArrayAlloc',
401      [stats_num_field('bytes allocated',
402                       [ (wordsize(32), 800040960, 5)
403                       , (wordsize(64), 1600040960, 5) ]),
404       only_ways(['normal'])],
405      compile_and_run,
406      ['-O2'])
407
408 test('InlineByteArrayAlloc',
409      [stats_num_field('bytes allocated',
410                       [ (wordsize(32), 1360036012, 5)
411                       , (wordsize(64), 1440040960, 5) ]),
412          # 32 and 64 bit not so different, because 
413          # we are allocating *byte* arrays
414       only_ways(['normal'])],
415      compile_and_run,
416      ['-O2'])
417
418 test('InlineCloneArrayAlloc',
419      [stats_num_field('bytes allocated',
420                       [ (wordsize(32), 800041120, 5) 
421                       , (wordsize(64), 1600041120, 5) ]),
422       only_ways(['normal'])],
423      compile_and_run,
424      ['-O2'])
425
426 test('T9203',
427      [stats_num_field('bytes allocated',
428                       [ (wordsize(32), 84345136 , 5)
429                       # was
430                       # 2016-04-06     84345136 (i386/Debian) not sure
431                       , (wordsize(64), 95451192, 5) ]),
432                       # was            95747304
433                       # 2019-09-10     94547280 post-AMP cleanup
434                       # 2015-10-28     95451192 emit Typeable at definition site
435       only_ways(['normal'])],
436      compile_and_run,
437      ['-O2'])
438
439 test('T9339',
440      [stats_num_field('bytes allocated',
441                       [ (wordsize(32),    40046844, 5)
442                       , (wordsize(64),    80050760, 5) ]),
443                       # w/o fusing last: 320005080
444                       # 2014-07-22:       80050760
445       only_ways(['normal'])],
446      compile_and_run,
447      ['-O2'])
448
449 test('T8472',
450      [stats_num_field('bytes allocated',
451                       [ (wordsize(32),    50000, 80)
452                       , (wordsize(64),    51424, 80) ]),
453       only_ways(['normal'])],
454      compile_and_run,
455      ['-O2'])
456
457 test('T12996',
458      [stats_num_field('bytes allocated',
459                       [ (wordsize(64),    76776, 5) ]),
460       only_ways(['normal'])],
461      compile_and_run,
462      ['-O2'])
463
464 test('T13001',
465      [stats_num_field('bytes allocated',
466                       [ (wordsize(32),    46728, 20)
467                       , (wordsize(64),    50600, 20) ]),
468       only_ways(['normal'])],
469      compile_and_run,
470      ['-O2'])
471
472 test('T12990',
473     [stats_num_field('bytes allocated',
474                      [ (wordsize(64), 21640904, 5) ]),
475                      # 2017-01-03     34440936  w/o inlining unsaturated
476                      #                          constructor wrappers
477                      # 2017-01-03     21640904 inline wrappers
478      only_ways(['normal'])],
479     compile_and_run,
480     ['-O2'])