summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-11-03 10:37:59 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-11-03 15:07:14 +0000
commit37785df6febb50350bdc7967e7361eb68ee24425 (patch)
tree4edad67d5ce24c5db1dd69b19edfaa7235d465c5
parenta59bfa9f55af50abfad1f5349f9b69cfc39bd226 (diff)
downloadhaskell-37785df6febb50350bdc7967e7361eb68ee24425.tar.gz
Compiler performance is much worse in for loopy givens
This is a deliberate choice, to simplify code, invariants, and I think performance in typical cases. The "loopy givens" case is situations like [G] a ~ TF (a, Int) where TF is a type function with TF (a,b) = (TF a, TF b). See Note [An alternative story for the inert substitution] in TcFlatten.
-rw-r--r--testsuite/tests/perf/compiler/T5837.hs40
-rw-r--r--testsuite/tests/perf/compiler/all.T4
2 files changed, 38 insertions, 6 deletions
diff --git a/testsuite/tests/perf/compiler/T5837.hs b/testsuite/tests/perf/compiler/T5837.hs
index 1dc3c33cd9..6ebbd65bd5 100644
--- a/testsuite/tests/perf/compiler/T5837.hs
+++ b/testsuite/tests/perf/compiler/T5837.hs
@@ -10,14 +10,44 @@ t = undefined
{-
- [G] a ~ TF (a,Int)
+ [G] a ~ TF (a,Int) -- a = a_am1
-->
- TF (a,Int) ~ fsk
- fsk ~ a
+ [G] TF (a,Int) ~ fsk -- fsk = fsk_am8
+inert [G] fsk ~ a
+
--->
- fsk ~ (TF a, TF Int)
- fsk ~ a
+ [G] fsk ~ (TF a, TF Int)
+inert [G] fsk ~ a
+
--->
a ~ (TF a, TF Int)
+inert [G] fsk ~ a
+
+---> (attempting to flatten (TF a) so that it does not mention a
+ TF a ~ fsk2
+inert a ~ (fsk2, TF Int)
+inert fsk ~ (fsk2, TF Int)
+
+---> (substitute for a)
+ TF (fsk2, TF Int) ~ fsk2
+inert a ~ (fsk2, TF Int)
+inert fsk ~ (fsk2, TF Int)
+
+---> (top-level reduction, re-orient)
+ fsk2 ~ (TF fsk2, TF Int)
+inert a ~ (fsk2, TF Int)
+inert fsk ~ (fsk2, TF Int)
+
+---> (attempt to flatten (TF fsk2) to get rid of fsk2
+ TF fsk2 ~ fsk3
+ fsk2 ~ (fsk3, TF Int)
+inert a ~ (fsk2, TF Int)
+inert fsk ~ (fsk2, TF Int)
+
+--->
+ TF fsk2 ~ fsk3
+inert fsk2 ~ (fsk3, TF Int)
+inert a ~ ((fsk3, TF Int), TF Int)
+inert fsk ~ ((fsk3, TF Int), TF Int)
-} \ No newline at end of file
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 1a9dfcb297..3bce7ce417 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -454,7 +454,7 @@ test('T5837',
# 40000000 (x86/Linux)
# 2013-11-13: 45520936 (x86/Windows, 64bit machine)
# 2041-09-03: 37096484 (Windows laptop, w/w for INLINABLE things
- (wordsize(64), 75765728, 10)])
+ (wordsize(64), 651924880, 10)])
# sample: 3926235424 (amd64/Linux, 15/2/2012)
# 2012-10-02 81879216
# 2012-09-20 87254264 amd64/Linux
@@ -463,6 +463,8 @@ test('T5837',
# for constraints solving
# 2014-08-29 73639840 amd64/Linux, w/w for INLINABLE things
# 2014-10-08 73639840 amd64/Linux, Burning Bridges and other small changes
+ # 2014-11-02 651924880 Linux, Accept big regression;
+ # See Note [An alternative story for the inert substitution] in TcFlatten
],
compile_fail,['-ftype-function-depth=50'])