Modify the breakpoint desugaring to introduce more laziness
authorPepe Iborra <mnislaih@gmail.com>
Tue, 13 Feb 2007 20:30:43 +0000 (20:30 +0000)
committerPepe Iborra <mnislaih@gmail.com>
Tue, 13 Feb 2007 20:30:43 +0000 (20:30 +0000)
Benchmarks have shown that making the formation of the list of locals more lazy can improve performance of -fdebugging up to 50% in some cases

compiler/deSugar/DsBreakpoint.lhs

index 869cde6..07b3ec9 100644 (file)
@@ -39,6 +39,7 @@ import Outputable
 import ErrUtils
 import FastString
 import DynFlags
+import MkId
  
 import DsMonad 
 import {-#SOURCE#-}DsExpr ( dsLExpr ) 
@@ -77,7 +78,8 @@ mkBreakpointExpr loc bkptFuncId ty = do
                               , HsLit (HsInt (fromIntegral site))]
             funE  = l$ HsVar jumpFuncId
             ptrE  = l (HsLit (HsInt (fromIntegral (I# (addr2Int# addr#)))))
-            locsE = l locals
+            locsE = l (HsApp (l(HsWrap (WpTyApp (mkListTy opaqueTy)) (HsVar lazyId))) 
+                             (l locals))
             locE  = l locInfo
             msgE  = l (srcSpanLit loc)
         return $