INLINE hash to retain fusion with low-arity foldl'
Originally, hash
was eta-reduced and not explicitly inlined, and as a
result the foldl'
call here was not saturated. Thus the definition of hash
was simple enough to inline into the call site, where the provided string
allowed foldl'
to inline into foldr
, which then enabled fusion, avoiding
potentially non-trivial allocation overhead.
In ghc!5259 (merged), we're reducing the arity of foldl'
, so that it can inline with just
two arguments. This yields performance improvements in common idiomatic code,
see ghc!5259 (merged) for details.
That reduced arity makes foldl'
inline into even the eta-reduced hash
,
which then (for lack of an INLINE here) also inlined foldr
and the fusion
opportunity was lost.
* let's add that INLINE to hash in NofibUtils. We don't usually mess with
nofib, but we don't want to perpetuate reliance on a fluke.
In addition, eta-expanding hash
. It will now saturate both the original
and the post-ghc!5259 (merged) foldl'
.