[GHC] #15176: Superclass `Monad m =>` makes program run 100 times slower
GHC
ghc-devs at haskell.org
Wed Sep 5 09:36:06 UTC 2018
#15176: Superclass `Monad m =>` makes program run 100 times slower
-------------------------------------+-------------------------------------
Reporter: danilo2 | Owner: osa1
Type: bug | Status: new
Priority: highest | Milestone: 8.8.1
Component: Compiler | Version: 8.4.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
No no, don't do that!! Here are the big hitters in the `.ticky` files
{{{
==== Without Monad m (original.ticky) =========
15000000 984000000 0 2 SS vx{v
s21YX} (main:Main) (fun) in r1YhB
9000000 520000000 0 4 pSSS
$w$dLayersFoldableBuilder__{v r1YhB} (main:Main) (fun)
24000000 320000000 0 3 SpM
main:Main.$w$sgo1{v r19} (fun)
16000000 240000000 0 3 SpM
main:Main.$w$sgo3{v r1a} (fun)
4000000 232000000 0 2 SS
sat_s2229{v} (main:Main) (fun) in r1YhB
3000000 144000000 0 2 SS
sat_s21Zw{v} (main:Main) (fun) in s21YX
9000000 72000000 0 46 ++++++++++++++++++++ luna-
core-0.0.6-inplace:Luna.IR.Term.$fStorable1UniTerm10{v rihy9} (fun)
1000000 48000000 0 2 SS
lvl1355{v r1Yhx} (main:Main) (fun)
2000000 32000000 0 2 SI
lvl1206{v r1Yf3} (main:Main) (fun)
2000000 32000000 0 1 M luna-
core-0.0.6-inplace:Luna.IR.Term.$WUniTermVar{v rihwq} (fun)
1000000 24000000 0 2 SI
lvl1176{v r1Yez} (main:Main) (fun)
1000000 24000000 0 1 M luna-
core-0.0.6-inplace:Luna.IR.Term.$WUniTermUnify{v rihwr} (fun)
=========== With Monad m (patched.ticky) ==============
60000000 2496000000 0 7 +++++M. luna-
core-0.0.6-inplace:Data.Graph.Fold.Deep.$fLayerBuilderDeepmType_$clayerBuild{v
rGoW} (fun)
36000000 1584000000 0 3 >S.
$s$fFunctorStateT_$cfmap{v rmuaf} (luna-
core-0.0.6-inplace:OCI.Pass.Definition.Class) (fun)
24000000 1152000000 0 1 S
sat_s2hor{v} (main:Main) (fun) in r2gUO
20000000 960000000 0 1 S
sat_s2hqt{v} (main:Main) (fun) in r2gVh
6000000 480000000 0 3 pSS $wlvl{v
r2gUO} (main:Main) (fun)
5000000 400000000 0 3 pSS
$wlvl3{v r2gVh} (main:Main) (fun)
8000000 384000000 0 1 S
sat_s2hoV{v} (main:Main) (fun) in r2gUQ
6000000 384000000 0 3 SSS
$s$fReadertlayerm_$cread__3{v r2hmG} (main:Main) (fun)
6000000 384000000 0 3 SSS
$s$fReadertlayerm_$cread__2{v r2hmw} (main:Main) (fun)
24000000 320000000 0 3 SpM
main:Main.$w$sgo3{v r8e} (fun)
6000000 288000000 0 3 .SS luna-
core-0.0.6-inplace:OCI.Pass.Definition.Class.$fApplicativePass5{v rmu8N}
(fun)
12000000 288000000 0 2 .S lvl1{v
rmual} (luna-core-0.0.6-inplace:OCI.Pass.Definition.Class) (fun)
16000000 240000000 0 3 SpM
main:Main.$w$sgo1{v r8b} (fun)
2000000 160000000 0 3 pSS
$wlvl1{v r2gUQ} (main:Main) (fun)
8000000 120000000 0 7 ++++++M
$w$cbuild1{v riLVV} (luna-core-0.0.6-inplace:Luna.IR.Term) (fun)
9000000 96000000 0 3 SSM
sat_sHlw{v} (luna-core-0.0.6-inplace:Data.Graph.Fold.Deep) (fun) in rGoW
1000000 48000000 0 2 SS
lvl1702{v r2hn9} (main:Main) (fun)
2000000 32000000 0 2 SI
$cpeekByteOff1{v r3Y9N} (luna-core-0.0.6-inplace:Luna.IR.Term.Core) (fun)
2000000 32000000 0 1 M luna-
core-0.0.6-inplace:Luna.IR.Term.$WUniTermVar{v rihWA} (fun)
1000000 32000000 0 1 .
sat_siM5u{v} (luna-core-0.0.6-inplace:Luna.IR.Term) (fun) in riLVV
}}}
So we are getting a log of allocation in
* `luna-
core-0.0.6-inplace:Data.Graph.Fold.Deep.$fLayerBuilderDeepmType_$clayerBuild`
* `$s$fFunctorStateT_$cfmap{v rmuaf} (luna-
core-0.0.6-inplace:OCI.Pass.Definition.Class)`
Also, in the original version, the big allocation is in Main.
So I'd generate `Main.stg` and the STG files for `Data.Graph.Fold.Deep,
and perhaps OCI.Pass.Definition.Class.` to begin with
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15176#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list