#2680: Type-checking performance regression
------------------------------------------+---------------------------------
 Reporter:  igloo                         |          Owner:                  
     Type:  compile-time performance bug  |         Status:  new             
 Priority:  high                          |      Milestone:  6.10.1          
Component:  Compiler (Type checker)       |        Version:  6.8.3           
 Severity:  normal                        |     Resolution:                  
 Keywords:                                |     Difficulty:  Unknown         
 Testcase:                                |   Architecture:  Unknown/Multiple
       Os:  Unknown/Multiple              |  
------------------------------------------+---------------------------------
Comment (by simonmar):

 Replying to [comment:4 igloo]:
 > The problem is in the creation of `ent_map` in
 `iface/MkIface:mk_usage_info`. In this case, all of the `mod`s are the
 same, so `extendModuleEnv_C (++) mv_map mod [occ]` builds the list of them
 quadratically. Using `(flip (++))` brings the time down to a couple of
 seconds. It doesn't look to me like the order of elements should be
 important here, but can you confirm please?
 > {{{
 > hunk ./compiler/iface/MkIface.lhs 821
 > -             Just mod -> extendModuleEnv_C (++) mv_map mod [occ]
 > +             Just mod -> extendModuleEnv_C (flip (++)) mv_map mod [occ]
 > }}}

 Nice catch!

 That should be fine, although it's only a few extra characters to write
 {{{
   extendModuleEnv_C (\xs _ -> occ:xs) mv_map mod [occ]
 }}}
 which is a tad more efficient, and clearer to me.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2680#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to