diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-11-11 13:28:58 -0500 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2019-11-19 00:19:22 -0500 |
commit | bc2f9466878cf6add7e63f229690f8a9c6d7a58a (patch) | |
tree | ac9c32ee4a3a3d6c1f809312290bcd7ba459e2f0 /compiler/main | |
parent | cf7f8e5bbec83da1bb62075968bc78c86414c245 (diff) | |
download | haskell-wip/cache-module-unique.tar.gz |
Module: Cache the uniquewip/cache-module-unique
Previously Module's getUnique would build two FastStrings, concatenate
them, and hash them. This seems like a lot of work to duplicate given
that it can be cached with little effort.
I somewhat doubt this will measurably affect compiler performance but
it's possible since this will affect OrigNameCache lookups.
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/Packages.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index ca2e74dfcf..40ec40da1f 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -1112,7 +1112,8 @@ findWiredInPackages dflags prec_map pkgs vis_map = do -- what appears in PrelNames. upd_wired_in_mod :: WiredPackagesMap -> Module -> Module -upd_wired_in_mod wiredInMap (Module uid m) = Module (upd_wired_in_uid wiredInMap uid) m +upd_wired_in_mod wiredInMap m = + mkModule (upd_wired_in_uid wiredInMap (moduleUnitId m)) (moduleName m) upd_wired_in_uid :: WiredPackagesMap -> UnitId -> UnitId upd_wired_in_uid wiredInMap (DefiniteUnitId def_uid) = @@ -1709,9 +1710,9 @@ mkModuleToPkgConfAll dflags pkg_db vis_map = let (pk', m', origin') = case exposedReexport of Nothing -> (pk, m, fromExposedModules e) - Just (Module pk' m') -> - let pkg' = pkg_lookup pk' - in (pk', m', fromReexportedModules e pkg') + Just mod -> + let pkg' = pkg_lookup (moduleUnitId mod) + in (pk', moduleName mod, fromReexportedModules e pkg') return (m, mkModMap pk' m' origin') esmap :: UniqFM (Map Module ModuleOrigin) |