[Git][ghc/ghc][master] Avoid expensive computation for debug logging in `mergeDatabases` when log level is low
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 3a9470fd by Torsten Schmits at 2026-02-27T18:47:34-05:00 Avoid expensive computation for debug logging in `mergeDatabases` when log level is low This computed and traversed a set intersection for every single dependency unconditionally. - - - - - 1 changed file: - compiler/GHC/Unit/State.hs Changes: ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -1389,10 +1389,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" <+> ppr 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 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3a9470fd25359c61c644b63bbe6d67e1... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3a9470fd25359c61c644b63bbe6d67e1... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)