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