[commit: ghc] master: Avoid calling newDynFlags when there are no changes (7acee06)

git at git.haskell.org git at git.haskell.org
Wed Nov 16 14:31:17 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7acee066c210cd469836da32375988e5ee2b32ff/ghc

>---------------------------------------------------------------

commit 7acee066c210cd469836da32375988e5ee2b32ff
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Nov 15 17:19:04 2016 +0000

    Avoid calling newDynFlags when there are no changes
    
    This is a small optimisation for :set and :unset


>---------------------------------------------------------------

7acee066c210cd469836da32375988e5ee2b32ff
 ghc/GHCi/UI.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 3fe42d2..d3c62e6 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -2564,7 +2564,7 @@ setOptions wds =
       let (plus_opts, minus_opts)  = partitionWith isPlus wds
       mapM_ setOpt plus_opts
       -- then, dynamic flags
-      newDynFlags False minus_opts
+      when (not (null minus_opts)) $ newDynFlags False minus_opts
 
 packageFlagsChanged :: DynFlags -> DynFlags -> Bool
 packageFlagsChanged idflags1 idflags0 =
@@ -2661,7 +2661,7 @@ unsetOptions str
              mapM_ unsetOpt plus_opts
 
              no_flags <- mapM no_flag minus_opts
-             newDynFlags False no_flags
+             when (not (null no_flags)) $ newDynFlags False no_flags
 
 isMinus :: String -> Bool
 isMinus ('-':_) = True



More information about the ghc-commits mailing list