[commit: ghc] master: FastString: Reduce allocations of concatFS (91fd87e)

git at git.haskell.org git at git.haskell.org
Fri Jul 8 13:02:19 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/91fd87e2384091f1872f91953e83b299d8e1478f/ghc

>---------------------------------------------------------------

commit 91fd87e2384091f1872f91953e83b299d8e1478f
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.


>---------------------------------------------------------------

91fd87e2384091f1872f91953e83b299d8e1478f
 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 237c0a2..41889cf 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