
#12354: Word foldl' isn't optimized as well as Int foldl' -------------------------------------+------------------------------------- Reporter: kjslag | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | 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: | -------------------------------------+------------------------------------- Comment (by simonpj):
it turns out that Word’s enumFromTo is never inlined, so this setup has no chance of fusing here
So the short term solution is to add an INLINE for Word's `enumFromTo`?
Where does it stop?
Well you might hope that you could write `eftInt`, `eftIntFB` once, at type `a` and SPECIALISE them. That would save copying them manually. Writing rewrite rules that also specialise is something I have not thought much about though. I suppose that, conceivably, all the fusion could happen generically (i.e. on the class-overloaded functions), before we specialise to the particular type. To achieve that, we'd have to delay the class-op selection e.g. `eunmFrom dEnumInt` --> `enumFrom_Int`. But that ought to be possible. A good project here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12354#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler