Int / Word / IntN / WordN are unequally optimized
A lot of thought has been put into optimizing usage of
Int, but not all of these tweaks have been copied for usage of
Word, and the specific-size versions of both have even fewer optimizations. The consequence is that switching from signed to unsigned, or from unspecified to specified size, can result in dramatic performance loss.
builtin rules (
Word, but not sized alternatives
Int, but little of the others. Try
find libraries/ -name _darcs -prune -o -name *hs | xargs grep SPECIAL | grep '\<Int\|\<Word'
some instances have special cases for
Int, but not for the others (for instance, the
Wordversion uses generic code;
RULEShelp optimizing the special cases for
Intfurther (again, see the
Intfor an example)
See this thread "Int vs Word performance?" for more discussion.