[Git][ghc/ghc][wip/torsten.schmits/mwb-26-01/mp-backports] Avoid expensive computation for debug logging in `mergeDatabases` when log level is low
Torsten Schmits pushed to branch wip/torsten.schmits/mwb-26-01/mp-backports at Glasgow Haskell Compiler / GHC Commits: fe5932d4 by Torsten Schmits at 2026-04-22T02:29:34+02:00 Avoid expensive computation for debug logging in `mergeDatabases` when log level is low - - - - - 1 changed file: - compiler/GHC/Unit/State.hs Changes: ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -1401,10 +1401,11 @@ mergeDatabases logger = foldM merge (emptyUniqMap, emptyUniqMap) . zip [1..] merge (pkg_map, prec_map) (i, UnitDatabase db_path db) = do debugTraceMsg logger 2 $ text "loading package database" <+> OsPath.pprOsPath db_path - forM_ (Set.toList override_set) $ \pkg -> - debugTraceMsg logger 2 $ - text "package" <+> ppr pkg <+> - text "overrides a previously defined package" + when (log_verbosity (logFlags logger) >= 2) $ + forM_ (Set.toList override_set) $ \pkg -> + debugTraceMsg logger 2 $ + text "package" <+> ppr pkg <+> + text "overrides a previously defined package" return (pkg_map', prec_map') where db_map = mk_pkg_map db @@ -2382,4 +2383,3 @@ implicitPackageDeps dflags = [thUnitId | xopt TemplateHaskellQuotes dflags] -- TODO: Should also include `base` and `ghc-prim` if we use those implicitly, but -- it is possible to not depend on base (for example, see `ghc-prim`) - View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe5932d418e8221bb5bcd34954caca07... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe5932d418e8221bb5bcd34954caca07... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Torsten Schmits (@torsten.schmits)