[GHC] #9646: Simplifer non-determinism leading to 8 fold difference in run time performance

GHC ghc-devs at haskell.org
Sun Jun 19 14:49:24 UTC 2016


#9646: Simplifer non-determinism leading to 8 fold difference in run time
performance
-------------------------------------+-------------------------------------
        Reporter:  erikd             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Test Suite        |              Version:  7.8.3
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  Runtime           |            Test Case:
  performance bug                    |  testsuite/tests/simplCore/T9646
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2009
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * status:  closed => new
 * resolution:  fixed =>


Comment:

 This test is failing for `WAY=ghci`. This is the output, after adding
 `-fobject-code` (because of the use of unboxed tuples):

 {{{
 --- ./T9646.run/T9646.stdout.normalised 2016-06-19 16:49:06.204443094
 +0200
 +++ ./T9646.run/T9646.run.stdout.normalised     2016-06-19
 16:49:06.204443094 +0200
 @@ -1,3 +1,96 @@
 +
 +==================== Desugared ====================
 +bindIO
 +  ((\ @ a ->
 +      let {
 +        $dGHCiSandboxIO
 +        $dGHCiSandboxIO = $fGHCiSandboxIOIO } in
 +      ghciStepIO $dGHCiSandboxIO)
 +     (hSetBuffering stdout LineBuffering))
 +  (\ it -> returnIO (build (\ @ a c n -> c (unsafeCoerce# it) n)))
 +
 +
 +
 +==================== Simplifier statistics ====================
 +Total ticks:     12
 +
 +2 PreInlineUnconditionally
 +  1 tpl
 +  1 $dGHCiSandboxIO
 +1 UnfoldingDone 1 unsafeCoerce#
 +1 RuleFired 1 Class op ghciStepIO
 +1 EtaExpansion 1 it
 +7 BetaReduction
 +  1 k0
 +  1 k1
 +  1 a
 +  1 b
 +  1 tpl
 +  1 a
 +  1 a
 +
 +
 +
 +==================== Simplified expression ====================
 +bindIO
 +  (id (hSetBuffering stdout LineBuffering))
 +  ((\ it eta ->
 +      ((returnIO (build (\ @ a c n -> c it n))) `cast` ...) eta)
 +   `cast` ...)
 +
 +
 +
 +==================== Desugared ====================
 +let {
 +  $dMonad
 +  $dMonad = $fMonadIO } in
 +let {
 +  $dMonad
 +  $dMonad = $dMonad } in
 +bindIO
 +  ((\ @ a ->
 +      let {
 +        $dGHCiSandboxIO
 +        $dGHCiSandboxIO = $fGHCiSandboxIOIO } in
 +      ghciStepIO $dGHCiSandboxIO)
 +     (>> $dMonad (runIOFastExit main) (return $dMonad ())))
 +  (\ it -> returnIO (build (\ @ a c n -> c (unsafeCoerce# it) n)))
 +
 +
 +
 +==================== Simplifier statistics ====================
 +Total ticks:     16
 +
 +3 PreInlineUnconditionally
 +  1 tpl
 +  1 $dGHCiSandboxIO
 +  1 $dMonad
 +1 PostInlineUnconditionally 1 $dMonad
 +1 UnfoldingDone 1 unsafeCoerce#
 +3 RuleFired
 +  1 Class op >>
 +  1 Class op ghciStepIO
 +  1 Class op return
 +1 EtaExpansion 1 it
 +7 BetaReduction
 +  1 k0
 +  1 k1
 +  1 a
 +  1 b
 +  1 tpl
 +  1 a
 +  1 a
 +
 +
 +
 +==================== Simplified expression ====================
 +bindIO
 +  (id (thenIO (runIOFastExit main) ($fMonadIO_$creturn ())))
 +  ((\ it eta ->
 +      ((returnIO (build (\ @ a c n -> c it n))) `cast` ...) eta)
 +   `cast` ...)
 +
 +
  1234
  2345
  2893730
 *** unexpected failure for T9646(ghci)
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9646#comment:27>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list