
There has just been a fix for vector that improves on the bad performance of Word32 as compared to Int (https://github.com/haskell/vector/issues/21#issuecomment-44154305). The new benchmarks (https://rawgit.com/nh2/loop/master/results/bench-vector-bbd726d.html) now show Vector+Word32 on par, but functions in base, especially forM_, are still horrendously slow on Word32. On 28/04/14 05:24, John Lato wrote:
Ahh, you made me look at the core again. I think this is related to your observation about V.enumFromTo being the same as V.fromList. With Word32 the generated core shows that this goes via a list representation instead of a nice loop. Which makes me suspect there's some RULE that applies to Stream.enumFromTo that is firing in the first case but not the second. And if I build both versions with -ddump-rule-firings, indeed I see that the Int version has
Rule fired: enumFromTo<Int> [Stream]
With nothing comparable for the Word32 version. I'd imagine if you grep for that in the Vector sources, you'd find something interesting.
The EnumFromN version does not seem to suffer from this (but again it's necessary to evaluate the argument).