diff options
author | buggymcbugfix <4444-buggymcbugfix@users.noreply.gitlab.haskell.org> | 2020-05-15 14:57:14 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-21 12:18:06 -0400 |
commit | b552e53136abfd6d728563338df99bf899d16139 (patch) | |
tree | 45a4492d09e0504b0f20d3f3b657de33e84307c6 /testsuite/tests/perf | |
parent | 3451584f98d4a6b26dba4079b9a703e70a49a3ab (diff) | |
download | haskell-b552e53136abfd6d728563338df99bf899d16139.tar.gz |
Add INLINABLE pragmas to Enum list producers
The INLINABLE pragmas ensure that we export stable (unoptimised) unfoldings in
the interface file so we can do list fusion at usage sites.
Related tickets: #15185, #8763, #18178.
Diffstat (limited to 'testsuite/tests/perf')
-rw-r--r-- | testsuite/tests/perf/should_run/T15185.hs | 25 | ||||
-rw-r--r-- | testsuite/tests/perf/should_run/all.T | 5 |
2 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/T15185.hs b/testsuite/tests/perf/should_run/T15185.hs new file mode 100644 index 0000000000..e6a01252f4 --- /dev/null +++ b/testsuite/tests/perf/should_run/T15185.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE TypeApplications #-} + +-- Ensure that we do list fusion on `foldr f z [from..to]` for sized `Int` and +-- `Word` types. Related tickets: #15185, #8763. + +import Control.Exception (evaluate) +import Data.Int +import Data.Word + +fact :: Integral t => t -> t +fact n = product [1..n] + +main :: IO () +main = do + _ <- evaluate (fact @Int 50) + _ <- evaluate (fact @Int64 50) + _ <- evaluate (fact @Int32 50) + _ <- evaluate (fact @Int16 50) + _ <- evaluate (fact @Int8 50) + _ <- evaluate (fact @Word 50) + _ <- evaluate (fact @Word64 50) + _ <- evaluate (fact @Word32 50) + _ <- evaluate (fact @Word16 50) + _ <- evaluate (fact @Word8 50) + pure () diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 70bd0fa48c..2ad3a1a546 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -367,6 +367,11 @@ test('T15578', compile_and_run, ['-O2']) +test('T15185', + [collect_stats('bytes allocated', 5), only_ways(['normal'])], + compile_and_run, + ['-O']) + # Test performance of creating Uniques. test('UniqLoop', [collect_stats('bytes allocated',5), |