
#9434: GHC.List.reverse does not fuse -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: | Version: 7.9 libraries/base | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dfeuer): I've improved the rules for writing `reverse` back to a recursive form. It appears to be good to fuse in most cases. The main exceptions seem to be `filter p . reverse` (although `reverse . filter p` is good) and `takeWhile . reverse` (although `reverse . takeWhile` is good). The latter was investigated by Dan Doel. The problem seems to be that the closures built up in the bad cases end up allocating more than the conses they replace. Even the worst case for `nofib` (a `filter . reverse` form) isn't really too terrible. I think we're probably better off making this change than not. Note: rules to try to convert `filter p . reverse` back to a (slightly) better version seem inherently too fragile to want to bother with. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9434#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler