I\'m working on an implementation of one of the SHA3 candidates, JH. I\'m at the point where the algorithm pass all KATs (Known Answer Tests) provided by NIST, and have also mad
It looks like you did a fair amount of tweaking already; I'm curious what the performance is like without explicit strictness annotations (BangPatterns
) and the various compiler pragmas (UNPACK
, INLINE
)... Also, a dumb question: what optimization flags are you using?
Anyway, two suggestions which may be completely awful:
Data.Word.Word64
with GHC.Word.Word64#
, make sure word128Shift
is using Int#
, etc.) to avoid heap allocation. This is, of course, non-portable.Data.Sequence
instead of []
At any rate, rather than looking at the Core output, try looking at the intermediate C files (*.hc
) instead. It can be hard to wade through, but sometimes makes it obvious where the compiler wasn't quite as sharp as you'd hoped.