[commit: ghc] wip/T12357: FastString: Reduce allocations of concatFS (e3db922)
git at git.haskell.org
git at git.haskell.org
Tue Jul 5 07:48:18 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T12357
Link : http://ghc.haskell.org/trac/ghc/changeset/e3db922012d73a29e6574e35b2e20f7285f4c550/ghc
>---------------------------------------------------------------
commit e3db922012d73a29e6574e35b2e20f7285f4c550
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.
>---------------------------------------------------------------
e3db922012d73a29e6574e35b2e20f7285f4c550
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 32330f2..f58a5b5 100644
--- a/compiler/utils/FastString.hs
+++ b/compiler/utils/FastString.hs
@@ -512,7 +512,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