diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2019-10-20 02:30:01 +0200 |
---|---|---|
committer | Andreas Klebinger <klebinger.andreas@gmx.at> | 2019-10-21 16:06:10 +0200 |
commit | 11f53e604ac6f7029ae8a9e8f4247576490839d4 (patch) | |
tree | f07df8a51d7514d29b5df8a11896b8f32093f45a /compiler/coreSyn/CorePrep.hs | |
parent | c4c9904b324736dc5d190a91418e8d8f564d4104 (diff) | |
download | haskell-wip/andreask/withTimingRefactor.tar.gz |
Make dynflag argument for withTiming pure.wip/andreask/withTimingRefactor
19 times out of 20 we already have dynflags in scope.
We could just always use `return dflags`. But this is in fact not free.
When looking at some STG code I noticed that we always allocate a
closure for this expression in the heap. Clearly a waste in these cases.
For the other cases we can either just modify the callsite to
get dynflags or use the _D variants of withTiming I added which
will use getDynFlags under the hood.
Diffstat (limited to 'compiler/coreSyn/CorePrep.hs')
-rw-r--r-- | compiler/coreSyn/CorePrep.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index 9d4044cf57..2b68c2716b 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -178,7 +178,7 @@ type CpeRhs = CoreExpr -- Non-terminal 'rhs' corePrepPgm :: HscEnv -> Module -> ModLocation -> CoreProgram -> [TyCon] -> IO (CoreProgram, S.Set CostCentre) corePrepPgm hsc_env this_mod mod_loc binds data_tycons = - withTiming (pure dflags) + withTiming dflags (text "CorePrep"<+>brackets (ppr this_mod)) (const ()) $ do us <- mkSplitUniqSupply 's' @@ -206,7 +206,7 @@ corePrepPgm hsc_env this_mod mod_loc binds data_tycons = corePrepExpr :: DynFlags -> HscEnv -> CoreExpr -> IO CoreExpr corePrepExpr dflags hsc_env expr = - withTiming (pure dflags) (text "CorePrep [expr]") (const ()) $ do + withTiming dflags (text "CorePrep [expr]") (const ()) $ do us <- mkSplitUniqSupply 's' initialCorePrepEnv <- mkInitialCorePrepEnv dflags hsc_env let new_expr = initUs_ us (cpeBodyNF initialCorePrepEnv expr) |