Oleg Grenrus pushed to branch wip/shorter-this-module-links at Glasgow Haskell Compiler / GHC Commits: 13f9d8c3 by Oleg Grenrus at 2025-09-14T19:02:49+03:00 Use showUnique in internalAnchorIdent Showing the key of Unique as a number is generally not a great idea. GHC Unique has a tag in high bits, so the raw number is unnecessarily big. So now we have ```html <a href="#l-rvgK"><span class="hs-identifier hs-var hs-var">bar</span></a> ``` instead of ```html <a href="#local-6989586621679015689"><span class="hs-identifier hs-var hs-var">bar</span></a> ``` Together with previous changes of shorter intra-module links the effect on compressed files is not huge, that is expected as we simply remove repetitive contents which pack well. ``` 12_694_206 Agda-2.9.0-docs-orig.tar.gz 12_566_065 Agda-2.9.0-docs.tar.gz ``` However when unpacked, the difference can be significant, e.g. Agda's largest module source got 5% reduction: ``` 14_230_117 Agda.Syntax.Parser.Parser.html 13_422_109 Agda.Syntax.Parser.Parser.html ``` The whole hyperlinked source code directory got similar reduction ``` 121M Agda-2.9.0-docs-orig/src 114M Agda-2.9.0-docs/src ``` For the reference, sources are about 2/3 of the generated haddocks ``` 178M Agda-2.9.0-docs-old 172M Agda-2.9.0-docs ``` so we get around 3.5% size reduction overall. Not bad for a small local changes. - - - - - 5 changed files: - libffi-tarballs - nofib - utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs - utils/hpc - utils/hsc2hs Changes: ===================================== libffi-tarballs ===================================== @@ -1 +1 @@ -Subproject commit 7c51059557b68d29820a0a87cebfa6fe73c8adf5 +Subproject commit 89a9b01c5647c8f0d3899435b99df690f582e9f1 ===================================== nofib ===================================== @@ -1 +1 @@ -Subproject commit b7391df4540ac8b11b35e1b2e2c15819b5171798 +Subproject commit da7eed00e494aba1da9f51cb92089ca10e2454e7 ===================================== utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs ===================================== @@ -14,7 +14,7 @@ import GHC.Iface.Ext.Types import GHC.Iface.Ext.Utils (emptyNodeInfo, isEvidenceContext) import GHC.Types.Name (Name, getOccString, isInternalName, nameModule, nameUnique) import GHC.Types.SrcLoc -import GHC.Types.Unique (getKey) +import GHC.Types.Unique (showUnique) import GHC.Unit.Module (Module, ModuleName, moduleNameString) import GHC.Utils.Encoding (utf8DecodeByteString) import System.FilePath.Posix ((>)) @@ -254,7 +254,7 @@ externalAnchorIdent :: Name -> String externalAnchorIdent = hypSrcNameUrl internalAnchorIdent :: Name -> String -internalAnchorIdent = ("local-" ++) . show . getKey . nameUnique +internalAnchorIdent = ("l-" ++) . showUnique . nameUnique -- | Generate the HTML hyperlink for an identifier hyperlink :: Module -> SrcMaps -> Identifier -> Html -> Html ===================================== utils/hpc ===================================== @@ -1 +1 @@ -Subproject commit 5923da3fe77993b7afc15b5163cffcaa7da6ecf5 +Subproject commit d1780eb21c1e5a1227fff80c8d325d5142f04255 ===================================== utils/hsc2hs ===================================== @@ -1 +1 @@ -Subproject commit fe3990b9f35000427b016a79330d9f195587cad8 +Subproject commit c3b21800a67366c9591dc85a471d1dfdb1efcf29 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/13f9d8c3ce03f14fc2d42374e76b84c3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/13f9d8c3ce03f14fc2d42374e76b84c3... You're receiving this email because of your account on gitlab.haskell.org.