summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-07-15 00:10:27 +0100
committerIan Lynagh <igloo@earth.li>2012-07-15 00:36:53 +0100
commit509d2ad24e377b8f9d3487ab7a3b2c3d1d936eaa (patch)
treed4f450196a096549acbc2ee7a744da9f3f977f74 /ghc
parent2f01debc33a3ba60feaf2f9add0778bbd2ab81c2 (diff)
downloadhaskell-509d2ad24e377b8f9d3487ab7a3b2c3d1d936eaa.tar.gz
Add a separate FastZString type
FastStrings are now always UTF8-encoded. There's no StringTable for FastZString, but I don't think one is needed. We only ever make a FastZString by running zEncodeFS on a FastString, and the FastStrings are shared via the FastString StringTable, so we get the same FastZString from the IORef.
Diffstat (limited to 'ghc')
-rw-r--r--ghc/Main.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index b65f9124c1..a53912c926 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -715,12 +715,11 @@ dumpFinalStats dflags =
dumpFastStringStats :: DynFlags -> IO ()
dumpFastStringStats dflags = do
buckets <- getFastStringTable
- let (entries, longest, is_z, has_z) = countFS 0 0 0 0 buckets
+ let (entries, longest, has_z) = countFS 0 0 0 buckets
msg = text "FastString stats:" $$
nest 4 (vcat [text "size: " <+> int (length buckets),
text "entries: " <+> int entries,
text "longest chain: " <+> int longest,
- text "z-encoded: " <+> (is_z `pcntOf` entries),
text "has z-encoding: " <+> (has_z `pcntOf` entries)
])
-- we usually get more "has z-encoding" than "z-encoded", because
@@ -732,17 +731,16 @@ dumpFastStringStats dflags = do
where
x `pcntOf` y = int ((x * 100) `quot` y) <> char '%'
-countFS :: Int -> Int -> Int -> Int -> [[FastString]] -> (Int, Int, Int, Int)
-countFS entries longest is_z has_z [] = (entries, longest, is_z, has_z)
-countFS entries longest is_z has_z (b:bs) =
+countFS :: Int -> Int -> Int -> [[FastString]] -> (Int, Int, Int)
+countFS entries longest has_z [] = (entries, longest, has_z)
+countFS entries longest has_z (b:bs) =
let
len = length b
longest' = max len longest
entries' = entries + len
- is_zs = length (filter isZEncoded b)
has_zs = length (filter hasZEncoding b)
in
- countFS entries' longest' (is_z + is_zs) (has_z + has_zs) bs
+ countFS entries' longest' (has_z + has_zs) bs
-- -----------------------------------------------------------------------------
-- ABI hash support