1
1
{-# LANGUAGE BangPatterns #-}
2
+ {-# LANGUAGE CPP #-}
2
3
{-# LANGUAGE ScopedTypeVariables #-}
3
4
{-# LANGUAGE TypeApplications #-}
4
5
{- |
@@ -27,12 +28,23 @@ tests = testGroup "allocations"
27
28
[ testCase " IO"
28
29
$ checkAllocations (linear 8 )
29
30
$ whnfIO (VU. traverse (\ _ -> getAllocationCounter) vector)
31
+
32
+ #if MIN_VERSION_base(4,17,0)
33
+ -- GHC<9.4 doesn't optimize well.
30
34
, testCase " ST"
31
35
$ checkAllocations (linear 8 )
32
36
$ (\ v -> runST $ VU. traverse (pureST . fromIntegral ) v) `whnf` vector
37
+ #endif
38
+
39
+ #if MIN_VERSION_base(4,15,0)
40
+ -- GHC<9.0 doesn't optimize this well. And there's no appetite
41
+ -- for finding out why. Thus it's disabled for them. We'll still
42
+ -- catch regression going forward.
33
43
, testCase " Identity"
34
44
$ checkAllocations (linear 8 )
35
45
$ VU. traverse (\ n -> Identity (10 * n)) `whnf` vector
46
+ #endif
47
+
36
48
-- NOTE: Naive traversal is lazy and allocated 2 words per element
37
49
--
38
50
-- , testCase "Const Sum"
@@ -43,9 +55,14 @@ tests = testGroup "allocations"
43
55
[ testCase " IO"
44
56
$ checkAllocations (linear 8 )
45
57
$ whnfIO (VU. replicateM size getAllocationCounter)
58
+
59
+ #if MIN_VERSION_base(4,17,0)
60
+ -- GHC<9.4 doesn't optimize well.
46
61
, testCase " ST"
47
62
$ checkAllocations (linear 8 )
48
63
$ (\ sz -> runST $ VU. generateM sz pureST) `whnf` size
64
+ #endif
65
+
49
66
-- , testCase "Identity"
50
67
-- $ checkAllocations (linear 8)
51
68
-- $ (\sz -> VU.generateM sz (\n -> Identity (fromIntegral n :: Int64))) `whnf` size
0 commit comments