From 84b135695d79c2c416b7746ebad8f39f9d2ab57e Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 4 Jul 2016 20:33:57 -0400 Subject: FastString: Reduce allocations of concatFS Instead of unpacking and then repacking we simply concatenate all of the individual ByteStrings. --- 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 40c3882b87..407c185ee8 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" -- cgit v1.2.1