patch applied (packages/base): Fix Trac #3245: memoising typeOf

Simon Peyton Jones simonpj at microsoft.com
Mon Dec 21 11:20:56 EST 2009


Fri Dec 18 07:51:17 PST 2009  simonpj at microsoft.com
  * Fix Trac #3245: memoising typeOf
  Ignore-this: 5a178a7f2222293c5ee0c3c43bd1b625
  
  The performance bug in #3245 was caused by computing the typeRep
  once for each call of typeOf, rather than once for each dictionary
  contruction.  (Computing TypeReps is reasonably expensive, because
  of the hash-consing machinery.)
  
  This is readily fixed by putting the TypeRep construction outside
  the lambda.  (Arguably GHC might have worked that out itself,
  but it involves floating something between a type lambda and a
  value lambda, which GHC doesn't currently do. If it happens a lot
  we could fix that.)

    M ./Data/Typeable.hs -29 +52

View patch online:
http://darcs.haskell.org/packages/base/_darcs/patches/20091218155117-1287e-e5a9da3293ce1d490930a6098ec4746bffc19083.gz


More information about the Cvs-libraries mailing list