
#14564: CAF isn't floated -------------------------------------+------------------------------------- Reporter: neil.mayhew | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime Unknown/Multiple | performance bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In the following code, `pattern` isn't floated, and the execution time is 20x slower than it should be: {{{#!hs import Text.Regex.TDFA (Regex, makeRegex, match) main :: IO () main = do entries <- map parseFilename . lines <$> getContents let check (Right (_, t)) = last t == 'Z' check _ = False print $ all check entries parseFilename :: String -> Either String (String, String) parseFilename fn = case (pattern `match` fn :: [[String]]) of [[_, full, _, time]] -> Right $ (full, time) _ -> Left fn where pattern :: Regex pattern = makeRegex "^\\./duplicity-(full|inc|new)(-signatures)?\\.\ \([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]T[0-9][0-9][0-9][0-9][0-9][0-9]Z)\\." }}} Curiously, it is floated when profiling is enabled, so the profiled program ends up being 7x faster than the unprofiled one. I can float the code manually (by taking out `where` and unindenting) and the program then runs at an acceptable speed. I get the same behaviour with 8.0.2, 8.2.1 and 8.2.2 but 7.10.3 is OK. I don't think the OS and architecture makes a difference, but for the record I'm on various flavours of 64-bit Linux. Test input data is [https://gist.github.com/neilmayhew/247a30738c0e294902e7c2830ca2c6f5 here] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14564 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler