[GHC] #14737: Improve performance of Simplify.simplCast
GHC
ghc-devs at haskell.org
Fri Mar 30 09:21:07 UTC 2018
#14737: Improve performance of Simplify.simplCast
-------------------------------------+-------------------------------------
Reporter: tdammers | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #11735 #14683 | Differential Rev(s): Phab:D4385
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by tdammers):
> However, that may still leave simplCast at the top... does it? If it was
taking 78% of 20sec before, that's 16 sec. So reducing that to near-zero
(which it should be) would take use to 5s, not 12s.
Correct; `isReflexiveCo` accounted for about half the execution time spent
in `simplCast`. With this change, `isReflexiveCo` drops to 1.1% of overall
execution time, and `simplCast` to about 61%. So this is a big
improvement, but we're not done yet. The remaining main culprit is
`pushCoTyArg`.
> What happens if you leave out the call to isReflexiveCo altogether?
It'll get done in the next round anyway, by optCoercion.
I'll try that, but considering that `isReflexiveCo` is no longer critical,
I don't expect it to make much of a difference.
For reference, here's the current profiler output:
{{{
Wed Mar 28 20:44 2018 Time and Allocation Profiling Report
(Final)
ghc-stage2 +RTS -p -RTS -B/home/tobias/well-
typed/devel/ghc/T14737/inplace/lib ./cases/Grammar.hs -o ./a -fforce-
recomp
total time = 12.35 secs (12354 ticks @ 1000 us, 1
processor)
total alloc = 14,410,284,936 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC
%time %alloc
pushCoTyArg Simplify compiler/simplCore/Simplify.hs:1229:63-83
54.6 55.5
tc_rn_src_decls TcRnDriver
compiler/typecheck/TcRnDriver.hs:(494,4)-(556,7) 13.1 14.3
CoreTidy HscMain compiler/main/HscMain.hs:1253:27-67
4.8 3.9
SimplTopBinds SimplCore compiler/simplCore/SimplCore.hs:770:39-74
4.2 3.2
coercionKind Coercion compiler/types/Coercion.hs:1701:3-7
2.8 6.0
simplCast Simplify
compiler/simplCore/Simplify.hs:(1213,5)-(1215,37) 2.5 2.5
zonkTopDecls TcRnDriver
compiler/typecheck/TcRnDriver.hs:(445,16)-(446,43) 2.3 2.2
deSugar HscMain compiler/main/HscMain.hs:511:7-44
1.5 1.3
isReflexiveCo Simplify compiler/simplCore/Simplify.hs:1260:40-55
1.1 1.0
Parser HscMain compiler/main/HscMain.hs:(316,5)-(384,20)
1.1 1.6
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14737#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list