CAF isn't floated
In the following code, pattern isn't floated, and the execution time is 20x slower than it should be:
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 here
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |