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/ghci | |
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/ghci')
-rw-r--r-- | compiler/ghci/ByteCodeLink.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/ghci/ByteCodeLink.hs b/compiler/ghci/ByteCodeLink.hs index 9138d1c125..1d228f9b80 100644 --- a/compiler/ghci/ByteCodeLink.hs +++ b/compiler/ghci/ByteCodeLink.hs @@ -162,14 +162,14 @@ linkFail who what nameToCLabel :: Name -> String -> FastString nameToCLabel n suffix = mkFastString label where - encodeZ = zString . zEncodeFS - (Module pkgKey modName) = ASSERT( isExternalName n ) nameModule n - packagePart = encodeZ (unitIdFS pkgKey) - modulePart = encodeZ (moduleNameFS modName) + encodeZ = zString . zEncodeFS + mod = ASSERT( isExternalName n ) nameModule n + packagePart = encodeZ (unitIdFS $ moduleUnitId mod) + modulePart = encodeZ (moduleNameFS $ moduleName mod) occPart = encodeZ (occNameFS (nameOccName n)) label = concat - [ if pkgKey == mainUnitId then "" else packagePart ++ "_" + [ if moduleUnitId mod == mainUnitId then "" else packagePart ++ "_" , modulePart , '_':occPart , '_':suffix |