
#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): I ran a selection of commits against two test inputs: Grammar.hs, as above, and the `test_rules2.hs` file from #5631. Here's a list of execution times for both: {{{ --- ./cases/Grammar.hs --- 452dee3ff4: 245.51 4572849929: 19.62 4eb140f564: 12.25 8a6aa5030d: 12.26 d74b37d565: 16.14 --- ./cases/test_rules2.hs --- 452dee3ff4: 1.20 4572849929: 1.19 4eb140f564: 1.19 8a6aa5030d: 1.23 d74b37d565: 1.18 }}} The commits are: {{{ 452dee3ff4: GHC `master` before branching off on this issue (should be the same as GHC HEAD) 4572849929: Simon's patch from [comment:5] applied. 4eb140f564: After "un-refactoring" 8a6aa5030d: With coercion roles cached, and mkNthCo taking an extra Role argument d74b37d565: current HEAD of wip/tdammers/T11735 }}} (Note that the execution times are a bit faster overall in this run because I didn't pass any `-ddump` flags, so GHC spends no time pretty- printing the dumps). So, conclusions: - The [comment:5] patch makes a huge difference for `Grammar.hs` (down to less than 10% in execution time) - "un-refactoring", strangely enough, improves performance on `Grammar.hs` by roughly another 25% or so - caching coercion rules in NthCo doesn't seem to make a difference at all, and even makes things slightly worse (this one is truly baffling IMO) - improvements from [comment:41] make the `Grammar.hs` test case worse (this, too, is unexpected) - none of the changes here seem to affect performance for the `test_rules2.hs` case much, if at all -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11735#comment:46 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler