Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/ed043776f3363b2b9e56f1e9836a250f43c28d26 >--------------------------------------------------------------- commit ed043776f3363b2b9e56f1e9836a250f43c28d26 Author: Simon Marlow <[email protected]> Date: Tue Nov 22 14:09:05 2011 +0000 uType_defer: only call mkErrInfo if -ddump-tc-trace is on (#5631) Profiling shows we're wasting a lot of time calling mkErrInfo and tidying the context, work that is wasted if we're not tracing. There is more to this compilation performance regression than this, but this is one bug. >--------------------------------------------------------------- compiler/typecheck/TcUnify.lhs | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcUnify.lhs b/compiler/typecheck/TcUnify.lhs index 7fbcc5c..e049a87 100644 --- a/compiler/typecheck/TcUnify.lhs +++ b/compiler/typecheck/TcUnify.lhs @@ -59,6 +59,7 @@ import Var import VarSet import VarEnv import ErrUtils +import DynFlags import BasicTypes import Maybes ( allMaybes ) import Util @@ -542,10 +543,14 @@ uType_defer (item : origin) ty1 ty2 ; emitFlat (mkEvVarX eqv loc) -- Error trace only - ; ctxt <- getErrCtxt - ; doc <- mkErrInfo emptyTidyEnv ctxt - ; traceTc "utype_defer" (vcat [ppr eqv, ppr ty1, ppr ty2, ppr origin, doc]) - + -- NB. do *not* call mkErrInfo unless tracing is on, because + -- it is hugely expensive (#5631) + ; ifDOptM Opt_D_dump_tc_trace $ do + { ctxt <- getErrCtxt + ; doc <- mkErrInfo emptyTidyEnv ctxt + ; traceTc "utype_defer" (vcat [ppr eqv, ppr ty1, + ppr ty2, ppr origin, doc]) + } ; return (mkEqVarLCo eqv) } uType_defer [] _ _ = panic "uType_defer" _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
