[commit: ghc] wip/T12357-concat: FastString: Reduce allocations of concatFS (84b1356)
git at git.haskell.org
git at git.haskell.org
Tue Jul 5 07:52:38 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T12357-concat
Link : http://ghc.haskell.org/trac/ghc/changeset/84b135695d79c2c416b7746ebad8f39f9d2ab57e/ghc
>---------------------------------------------------------------
commit 84b135695d79c2c416b7746ebad8f39f9d2ab57e
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.
>---------------------------------------------------------------
84b135695d79c2c416b7746ebad8f39f9d2ab57e
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