[commit: ghc] wip/new-flatten-skolems-Oct14: Compiler performance is much worse in for loopy givens (37785df)

git at git.haskell.org git at git.haskell.org
Mon Nov 3 17:23:46 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/new-flatten-skolems-Oct14
Link       : http://ghc.haskell.org/trac/ghc/changeset/37785df6febb50350bdc7967e7361eb68ee24425/ghc

>---------------------------------------------------------------

commit 37785df6febb50350bdc7967e7361eb68ee24425
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Nov 3 10:37:59 2014 +0000

    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.


>---------------------------------------------------------------

37785df6febb50350bdc7967e7361eb68ee24425
 testsuite/tests/perf/compiler/T5837.hs | 40 +++++++++++++++++++++++++++++-----
 testsuite/tests/perf/compiler/all.T    |  4 +++-
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/testsuite/tests/perf/compiler/T5837.hs b/testsuite/tests/perf/compiler/T5837.hs
index 1dc3c33..6ebbd65 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 1a9dfcb..3bce7ce 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'])
 



More information about the ghc-commits mailing list