
#9355: scanr does not participate in stream fusion -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.4 Component: | Version: 7.8.3 libraries/base | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Moderate (less Unknown/Multiple | than a day) Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dfeuer): Replying to [comment:2 nomeata]:
(because the argument to build isn't allowed to inspect its own result as the implementation in Data.List does),
I wouldn’t be surprised that returning `(# x, x:xs #)` is faster than returning `x:xs` and pattern matching on it. OTOH, the CPR optimization should change the code returning `x:xs` into (# x, xs #) and move the consing to the caller.
Can’t you do that by hand, i.e.: SNIP But I don’t expect there to be a measurable difference (and I didn’t check):
I brilliantly read your code wrong and drew a bad conclusion. This looks much better than I initially thought (Look, ma, no `let`! ). I'm going to see how nofib likes it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9355#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler