be262ba1a996a50908881e166b5db127706fcb3b
[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', [], run_command, ['$MAKE -s --no-print-directory T3736'])
116 test('T3738',
117      [extra_clean(['T3738a.hi', 'T3738a.o']),
118       stats_num_field('peak_megabytes_allocated', (2, 0)),
119                     # expected value: 1 (amd64/Linux)
120                     # 2016-08-31:     2 (allocation area size bumped to 1MB)
121       stats_num_field('bytes allocated',
122                       [(wordsize(32), 45648, 5),
123                     # expected value: 50520 (x86/Linux)
124                        (wordsize(64), 50592, 8)]),
125                     # prev:           49400 (amd64/Linux)
126                     # 2014-07-17:     50520 (amd64/Linux) general round of updates
127                     # 2014-09-10:     50592 (amd64/Linux) post-AMP-update
128                     # 2015-04-03: Widen 5->8% (amd64/Windows was doing better)
129       only_ways(['normal'])
130       ],
131      compile_and_run,
132      ['-O'])
133
134 test('MethSharing',
135      [stats_num_field('peak_megabytes_allocated', (2, 0)),
136                     # expected value: 1 (amd64/Linux)
137                     # 2016-08-31:     2 (allocation area size bumped to 1MB)
138       stats_num_field('bytes allocated',
139                       [(wordsize(32), 360940756, 5),
140                     # expected value: 2685858140 (x86/OS X)
141                           # expected: 360940756 (x86/Linux)
142                        (wordsize(64), 640067672, 5)]),
143                           # expected: 640067672 (amd64/Linux)
144       only_ways(['normal'])
145       ],
146      compile_and_run,
147      ['-O'])
148 test('T2902', [], run_command, ['$MAKE -s --no-print-directory T2902'])
149 test('T149',
150      [ # expect_broken(149),
151        # working (2 Jul 2013, x86-64/Linux)
152       extra_clean(['T149_A',    'T149_B',
153                    'T149_A.hi', 'T149_B.hi',
154                    'T149_A.o',  'T149_B.o'])],
155      run_command,
156      ['$MAKE -s --no-print-directory T149'])
157
158 test('T5113',
159      [stats_num_field('bytes allocated',
160                       [(wordsize(32), 4000000, 5),
161                        (wordsize(64), 8000000, 5)]),
162       only_ways(['normal'])
163       ],
164      compile_and_run,
165      ['-O'])
166
167
168 test('T4978',
169      [stats_num_field('bytes allocated',
170                       [(wordsize(32), 10000000, 5),
171                        (wordsize(64), 10137680, 5)]),
172                     # expected value: 10137680 (amd64/Linux)
173       only_ways(['normal'])
174       ],
175      compile_and_run,
176      ['-O2'])
177
178 test('T5205',
179      [stats_num_field('bytes allocated',
180                       [(wordsize(32), 47088, 5),
181                     # expected value: 47088 (x86/Darwin)
182
183                        (platform('x86_64-unknown-mingw32'), 52264, 5),
184                     # 2016-12-14: 52264 (Separate out Windows results)
185
186                        (wordsize(64), 56208, 5)]),
187                     # expected value: 51320 (amd64/Linux)
188                     # 2014-07-17:     52600 (amd64/Linux) general round of updates
189                     # 2015-04-03: Widen 5->7% (amd64/Windows was doing better)
190                     # 2015-08-15: 50648 (Windows too good. avg of Windows&Linux)
191                     # 2015-10-30: 56208 (D757: Emit Typeable at definition site)
192                     # 2016-12-14: Narrow 7->5% (Separate out Windows results)
193       only_ways(['normal', 'optasm'])
194       ],
195      compile_and_run,
196      [''])
197
198 test('T5549',
199      [stats_num_field('bytes allocated',
200                       [(wordsize(32), 4096606332, 5),
201                     # expected value: 3362958676 (Windows)
202                     # 2014-12-01:     4096606332 (Windows) integer-gmp2
203
204                        (wordsize(64), 5793140200, 5)]),
205                     # expected value: 6725846120 (amd64/Linux)
206                     #                 8193140752 (amd64/Linux) integer-gmp2
207                     #                 5793140200 (amd64/Linux) integer-gmp2
208       only_ways(['normal'])
209       ],
210      compile_and_run,
211      ['-O'])
212
213 test('T4474a',
214      [stats_num_field('bytes allocated',
215                       [(wordsize(32), 2405242767, 5),
216                        (wordsize(64), 4831890304, 5)]),
217                     # expected value: 4831890304 (amd64/OSX)
218       only_ways(['normal'])
219       ],
220      compile_and_run,
221      ['-O'])
222 test('T4474b',
223      [stats_num_field('bytes allocated',
224                       [(wordsize(32), 2405242767, 5),
225                        (wordsize(64), 4831890304, 5)]),
226                     # expected value: 4831890304 (amd64/OSX)
227       only_ways(['normal'])
228       ],
229      compile_and_run,
230      ['-O'])
231 test('T4474c',
232      [stats_num_field('bytes allocated',
233                       [(wordsize(32), 2405242767, 5),
234                        (wordsize(64), 4831890304, 5)]),
235                     # expected value: 4831890304 (amd64/OSX)
236       only_ways(['normal'])
237       ],
238      compile_and_run,
239      ['-O'])
240
241 test('T5237',
242      [stats_num_field('bytes allocated',
243                         [(platform('i386-unknown-mingw32'), 73280, 5),
244                          (wordsize(32), 78328, 5),
245                       # expected value: 78328 (i386/Linux)
246                          (wordsize(64), 104176, 5)]),
247                       # expected value: 110888 (amd64/Linux)
248                       # expected value: 104176 (amd64/Linux)
249      only_ways(['normal'])
250      ],
251     compile_and_run,
252     ['-O ' + sse2_opts])
253
254 test('T5536',
255      [stats_num_field('bytes allocated',
256                       [(wordsize(32), 446260520, 1),
257                                    # 1246287228 (i386/Linux)
258                                     # 446328556 (i386/Windows)
259                                     # 446192484 (i386/OSX)
260                        (wordsize(64), 892399040, 5)]),
261                    # expected value: 2492589480 (amd64/Linux)
262                    # 17/1/13:         892399040 (x86_64/Linux)
263                    #                  (new demand analyser)
264      extra_clean(['T5536.data']),
265      ignore_stdout,
266      only_ways(['normal'])
267      ],
268     compile_and_run,
269     ['-O'])
270
271 test('T7257',
272      [stats_num_field('bytes allocated',
273                       [(wordsize(32), 989850664, 10),
274                         # expected value: 1246287228 (i386/Linux)
275                         # 2016-04-06: 989850664 (i386/Linux) no idea what happened
276                        (wordsize(64), 1414893248, 5)]),
277                         # 2012-09-21: 1774893760 (amd64/Linux)
278                         # 2015-11-03: 1654893248 (amd64/Linux)
279                         # 2016-06-22: 1414893248 (amd64/Linux, sizeExpr fix)
280       stats_num_field('peak_megabytes_allocated',
281                       [(wordsize(32), 217, 5),
282                         # 2012-10-08: 217 (x86/Linux)
283                        (wordsize(64), 227, 5)]),
284                         # 2012-09-21: 227 (amd64/Linux)
285
286       only_ways(['normal'])
287      ],
288     compile_and_run, ['-O'])
289
290 test('Conversions',
291      [stats_num_field('bytes allocated',
292                       [(wordsize(32), 76768, 3),
293                         # 2012-12-18: 55316 Guessed 64-bit value / 2
294                         # 2013-02-10: 77472 (x86/OSX)
295                         # 2013-02-10: 79276 (x86/Windows)
296                         # 2014-01-13: 76768 (x86/Linux) due to #8647
297                        (wordsize(64), 107544, 5)]),
298                         # 2012-12-18: 109608 (amd64/OS X)
299                         # 2014-07-17: 107544 (amd64/Linux)
300
301       only_ways(['normal'])
302      ],
303     compile_and_run, ['-O -msse2'])
304
305 test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
306 # For 7507, stack overflow is the bad case
307
308 test('T7436',
309      [stats_num_field('max_bytes_used',
310           [(wordsize(64), 60360, 4),
311            #             127000 (amd64/Linux)
312            # 2013-02-07:  60360 (amd64/Linux)
313            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
314            (wordsize(32), 58434, 1)]),
315             # 2013-02-10: 58032 (x86/Windows)
316             # 2013-02-10: 58836 (x86/OSX)
317       only_ways(['normal'])
318       ],
319      compile_and_run,
320      ['-O'])
321
322 test('T7797',
323       [stats_num_field('bytes allocated',
324                       [(wordsize(32), 240044984, 5),
325                           # expected value: 2685858140 (x86/OS X)
326                           # expected: 360940756 (x86/Linux)
327                           # expected: 240044984 (x86/Windows, 64bit machine)
328                        (wordsize(64), 480050944, 5)]),
329                           # expected: 480050944 (amd64/Linux)
330       extra_clean(['T7797a.hi', 'T7797a.o']),
331       only_ways(['normal'])
332       ],
333      compile_and_run,
334      ['-O'])
335
336 test('T7954',
337       [stats_num_field('bytes allocated',
338                       [(wordsize(32), 920045264, 10),
339               # some date:  1380051408    (64-bit Windows machine)
340               # 2014-04-04:  920045264    (64-bit Windows machine)
341                        (wordsize(64), 1680051336, 10)]),
342               # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis
343       only_ways(['normal'])
344       ],
345      compile_and_run,
346      ['-O'])
347
348 test('T7850',
349      [stats_num_field('peak_megabytes_allocated', 
350                       [(wordsize(32), 2, 10),
351                        (wordsize(64), 4, 10)]),
352       only_ways(['normal'])],
353      compile_and_run,
354      ['-O'])
355
356 test('T5949',
357      [stats_num_field('bytes allocated',
358                       [ (wordsize(32), 116020, 10),
359                         (wordsize(64), 201008, 10)]),
360                       # previously, it was >400000 bytes
361       only_ways(['normal'])],
362      compile_and_run,
363      ['-O'])
364
365 test('T4267',
366      [stats_num_field('bytes allocated',
367                       [ (wordsize(32), 36012, 10)
368                       # 32-bit value close to 64 bit; c.f. T7619
369                       , (wordsize(64), 40992, 10) ]),
370                       # previously, it was >170000 bytes
371                       # 2014-01-17: 130000
372                       # 2014-02-10: 40992 (x86_64/Linux), call arity analysis
373       only_ways(['normal'])],
374      compile_and_run,
375      ['-O'])
376
377 test('T7619',
378      [stats_num_field('bytes allocated',
379                       [ (wordsize(32), 36012, 10)
380                       # 32-bit close to 64-bit value; most of this very 
381                       # small number is standard start-up boilerplate I think
382                       , (wordsize(64), 40992, 10) ]),
383                       # previously, it was >400000 bytes
384       only_ways(['normal'])],
385      compile_and_run,
386      ['-O'])
387
388 test('InlineArrayAlloc',
389      [stats_num_field('bytes allocated',
390                       [ (wordsize(32), 800040960, 5)
391                       , (wordsize(64), 1600040960, 5) ]),
392       only_ways(['normal'])],
393      compile_and_run,
394      ['-O2'])
395
396 test('InlineByteArrayAlloc',
397      [stats_num_field('bytes allocated',
398                       [ (wordsize(32), 1360036012, 5)
399                       , (wordsize(64), 1440040960, 5) ]),
400          # 32 and 64 bit not so different, because 
401          # we are allocating *byte* arrays
402       only_ways(['normal'])],
403      compile_and_run,
404      ['-O2'])
405
406 test('InlineCloneArrayAlloc',
407      [stats_num_field('bytes allocated',
408                       [ (wordsize(32), 800041120, 5) 
409                       , (wordsize(64), 1600041120, 5) ]),
410       only_ways(['normal'])],
411      compile_and_run,
412      ['-O2'])
413
414 test('T9203',
415      [stats_num_field('bytes allocated',
416                       [ (wordsize(32), 84345136 , 5)
417                       # was
418                       # 2016-04-06     84345136 (i386/Debian) not sure
419                       , (wordsize(64), 95451192, 5) ]),
420                       # was            95747304
421                       # 2019-09-10     94547280 post-AMP cleanup
422                       # 2015-10-28     95451192 emit Typeable at definition site
423       only_ways(['normal'])],
424      compile_and_run,
425      ['-O2'])
426
427 test('T9339',
428      [stats_num_field('bytes allocated',
429                       [ (wordsize(32),    40046844, 5)
430                       , (wordsize(64),    80050760, 5) ]),
431                       # w/o fusing last: 320005080
432                       # 2014-07-22:       80050760
433       only_ways(['normal'])],
434      compile_and_run,
435      ['-O2'])
436
437 test('T8472',
438      [stats_num_field('bytes allocated',
439                       [ (wordsize(32),    50000, 80)
440                       , (wordsize(64),    51424, 80) ]),
441       only_ways(['normal'])],
442      compile_and_run,
443      ['-O2'])
444
445 test('T12996',
446      [stats_num_field('bytes allocated',
447                       [ (wordsize(64),    76776, 5) ]),
448       only_ways(['normal'])],
449      compile_and_run,
450      ['-O2'])
451
452 test('T13001',
453      [stats_num_field('bytes allocated',
454                       [ (wordsize(32),    46728, 20)
455                       , (wordsize(64),    50600, 20) ]),
456       only_ways(['normal'])],
457      compile_and_run,
458      ['-O2'])
459
460 test('T12990',
461     [stats_num_field('bytes allocated',
462                      [ (wordsize(64), 21640904, 5) ]),
463                      # 2017-01-03     34440936  w/o inlining unsaturated
464                      #                          constructor wrappers
465                      # 2017-01-03     21640904 inline wrappers
466      only_ways(['normal'])],
467     compile_and_run,
468     ['-O2'])