
#11735: Optimize coercionKind -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by tdammers): Replying to [comment:55 simonpj]:
Do you have allocation numbers for these runs?
The mysterious thing is that `NthCo` caching makes things slightly worse. Of course the `NthCo` constructors have an extra field, but I'm still quite surprised that's a visible worsening. So I think it might be worth a little more digging into the worsening in `8ac966971e`, really just to discover if we have accidentally left money on the table.
Yes, of course. This is `8ac966971e`: {{{ Tue Jan 30 11:25 2018 Time and Allocation Profiling Report (Final) ghc-stage2 +RTS -p -RTS -B/home/tobias/well- typed/devel/ghc/inplace/lib ./cases/Grammar.hs -o ./a -fforce-recomp total time = 12.87 secs (12865 ticks @ 1000 us, 1 processor) total alloc = 14,385,409,080 bytes (excludes profiling overheads) COST CENTRE MODULE SRC %time %alloc simplCast Simplify compiler/simplCore/Simplify.hs:871:62-87 33.7 32.4 addCoerce-pushCoTyArg Simplify compiler/simplCore/Simplify.hs:(1236,12)-(1237,72) 13.1 13.1 tc_rn_src_decls TcRnDriver compiler/typecheck/TcRnDriver.hs:(494,4)-(556,7) 12.3 14.0 subst_ty TyCoRep compiler/types/TyCoRep.hs:2237:28-32 6.7 10.4 CoreTidy HscMain compiler/main/HscMain.hs:1253:27-67 4.4 3.9 coercionKind Coercion compiler/types/Coercion.hs:1725:3-7 2.6 6.0 zonkTopDecls TcRnDriver compiler/typecheck/TcRnDriver.hs:(445,16)-(446,43) 2.0 2.2 load'.checkHowMuch GhcMake compiler/main/GhcMake.hs:(270,9)-(272,27) 2.0 0.0 simplCast-simplCoercion Simplify compiler/simplCore/Simplify.hs:1224:57-77 1.6 1.5 simplExprF1-Lam Simplify compiler/simplCore/Simplify.hs:896:5-39 1.6 2.2 deSugar HscMain compiler/main/HscMain.hs:511:7-44 1.5 1.3 simplCast-addCoerce Simplify compiler/simplCore/Simplify.hs:1225:53-71 1.4 1.3 tcRnImports TcRnDriver compiler/typecheck/TcRnDriver.hs:240:20-50 1.0 0.1 Parser HscMain compiler/main/HscMain.hs:(316,5)-(384,20) 0.9 1.6 }}} Which isn't actually significantly worse than `4eb140f564`: {{{ Tue Jan 30 11:45 2018 Time and Allocation Profiling Report (Final) ghc-stage2 +RTS -p -RTS -B/home/tobias/well- typed/devel/ghc/inplace/lib ./cases/Grammar.hs -o ./a -fforce-recomp total time = 12.38 secs (12380 ticks @ 1000 us, 1 processor) total alloc = 14,385,403,880 bytes (excludes profiling overheads) COST CENTRE MODULE SRC %time %alloc simplCast Simplify compiler/simplCore/Simplify.hs:871:62-87 34.3 32.4 addCoerce-pushCoTyArg Simplify compiler/simplCore/Simplify.hs:(1236,12)-(1237,72) 13.3 13.1 tc_rn_src_decls TcRnDriver compiler/typecheck/TcRnDriver.hs:(494,4)-(556,7) 12.7 14.0 subst_ty TyCoRep compiler/types/TyCoRep.hs:2225:28-32 7.0 10.4 CoreTidy HscMain compiler/main/HscMain.hs:1253:27-67 4.5 3.9 coercionKind Coercion compiler/types/Coercion.hs:1707:3-7 2.9 6.0 zonkTopDecls TcRnDriver compiler/typecheck/TcRnDriver.hs:(445,16)-(446,43) 2.0 2.2 simplExprF1-Lam Simplify compiler/simplCore/Simplify.hs:896:5-39 1.8 2.2 simplCast-simplCoercion Simplify compiler/simplCore/Simplify.hs:1224:57-77 1.7 1.5 deSugar HscMain compiler/main/HscMain.hs:511:7-44 1.6 1.3 simplCast-addCoerce Simplify compiler/simplCore/Simplify.hs:1225:53-71 1.4 1.3 simplIdF Simplify compiler/simplCore/Simplify.hs:868:61-79 1.0 0.5 Parser HscMain compiler/main/HscMain.hs:(316,5)-(384,20) 1.0 1.6 }}} This is only about 4% more execution time, and 0.000035% more allocations. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11735#comment:57 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler