[commit: ghc] wip/T12357: FastString: Reduce allocations of concatFS (78339b0)
git at git.haskell.org
git at git.haskell.org
Tue Jul 5 10:12:17 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T12357
Link : http://ghc.haskell.org/trac/ghc/changeset/78339b06f9ac8ae56e4b8fe11c54bc3a5c81362f/ghc
>---------------------------------------------------------------
commit 78339b06f9ac8ae56e4b8fe11c54bc3a5c81362f
Author: Ben Gamari <ben at smart-cactus.org>
Date: Mon Jul 4 20:33:57 2016 -0400
FastString: Reduce allocations of concatFS
Instead of unpacking and then repacking we simply concatenate all of the
individual ByteStrings.
>---------------------------------------------------------------
78339b06f9ac8ae56e4b8fe11c54bc3a5c81362f
compiler/utils/FastString.hs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs
index 40c3882..407c185 100644
--- a/compiler/utils/FastString.hs
+++ b/compiler/utils/FastString.hs
@@ -513,7 +513,7 @@ appendFS fs1 fs2 = mkFastStringByteString
(fastStringToByteString fs2)
concatFS :: [FastString] -> FastString
-concatFS ls = mkFastString (Prelude.concat (map unpackFS ls)) -- ToDo: do better
+concatFS = mkFastStringByteString . BS.concat . map fs_bs
headFS :: FastString -> Char
headFS (FastString _ 0 _ _) = panic "headFS: Empty FastString"
More information about the ghc-commits
mailing list