summaryrefslogtreecommitdiff
path: root/testsuite/tests/callarity/unittest
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2015-04-15 13:32:32 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2015-04-15 16:39:41 +0200
commita9ca67f6bfb45d13944ba15452d3af613ec84d8b (patch)
tree17f8a939fa02d38dc9579e166354d1018b4b1620 /testsuite/tests/callarity/unittest
parent49d9b009a2affb6015b8f6e2f15e4660a53c0d9a (diff)
downloadhaskell-a9ca67f6bfb45d13944ba15452d3af613ec84d8b.tar.gz
Improve Call Arity performance
This improves how the Call Arity deals with "boring" variables. Boring variables are those where it does not bother to include in the analysis result, so whenever something is looked up in the analysis result, we have to make a conservative assumption about them. Previously, we extended the result with such conservative information about them, to keep the code uniform, but that could blow up the amount of data passed around, even if only temporarily, and slowed things down. We now pass around an explicit list (well, set) of variable that are boring and take that into account whenever we use the result. Not as pretty, but noticably faster.
Diffstat (limited to 'testsuite/tests/callarity/unittest')
-rw-r--r--testsuite/tests/callarity/unittest/CallArity1.hs5
-rw-r--r--testsuite/tests/callarity/unittest/CallArity1.stderr6
2 files changed, 10 insertions, 1 deletions
diff --git a/testsuite/tests/callarity/unittest/CallArity1.hs b/testsuite/tests/callarity/unittest/CallArity1.hs
index a92a73b4f2..b889a2f981 100644
--- a/testsuite/tests/callarity/unittest/CallArity1.hs
+++ b/testsuite/tests/callarity/unittest/CallArity1.hs
@@ -145,6 +145,11 @@ exprs =
Let (Rec [ (x, Var d `mkApps` [go `mkLApps` [1,2]])
, (go, mkLams [x] $ mkACase (mkLams [z] $ Var x) (Var go `mkVarApps` [x]) ) ]) $
Var go `mkApps` [mkLit 0, go `mkLApps` [0,1]]
+ , ("a thunk (non-function-type), in mutual recursion, causes many calls (d 1 would be bad)",) $
+ mkLet d (f `mkLApps` [0]) $
+ Let (Rec [ (x, Var go `mkApps` [go `mkLApps` [1,2], go `mkLApps` [1,2]])
+ , (go, mkLams [x] $ mkACase (Var d) (Var go `mkVarApps` [x]) ) ]) $
+ Var go `mkApps` [mkLit 0, go `mkLApps` [0,1]]
, ("a thunk (function type), in mutual recursion, still calls once (d 1 would be good)",) $
mkLet d (f `mkLApps` [0]) $
Let (Rec [ (n, Var go `mkApps` [d `mkLApps` [1]])
diff --git a/testsuite/tests/callarity/unittest/CallArity1.stderr b/testsuite/tests/callarity/unittest/CallArity1.stderr
index bd38032499..82cbc2ba01 100644
--- a/testsuite/tests/callarity/unittest/CallArity1.stderr
+++ b/testsuite/tests/callarity/unittest/CallArity1.stderr
@@ -63,7 +63,11 @@ a thunk (function type), called multiple times, still calls once:
a thunk (non-function-type), in mutual recursion, still calls once (d 1 would be good):
go 2
x 0
- d 1
+ d 0
+a thunk (non-function-type), in mutual recursion, causes many calls (d 1 would be bad):
+ go 2
+ x 0
+ d 0
a thunk (function type), in mutual recursion, still calls once (d 1 would be good):
go 1
d 1