performance regressions

Jan Stolarek jan.stolarek at p.lodz.pl
Tue Dec 16 07:59:41 UTC 2014


> Using this combinator instead of writing the algorithm directly cost me 30%
> allocation overhead!
What does your algorithm look like when you write it directly? Something like this:

flatten_many fmode roles tys
 = unzip `liftM` mapM go (zip roles tys)
 where
   go (Nominal,ty)          = flatten_one (fmode { fe_eq_rel = NomEq }) ty
   go (Representational,ty) = flatten_one (fmode { fe_eq_rel = ReprEq }) ty
   go (Phantom, ty)         = -- See Note [Phantoms in the flattener]
                              return (ty, mkTcPhantomCo ty ty)

?

Maybe this has something to do with `zipWithAndUnzipM` not being tail-recursive vs. direct version 
being able to fuse intermediate lists?

Janek


More information about the ghc-devs mailing list