Improving Data.Char.isSpace performance

John MacFarlane jgm at
Mon Oct 29 00:35:16 CET 2012

+++ Edward A Kmett [Oct 28 12 17:08 ]:
> It might be worth hunting for similar low hanging fruit as well.

No doubt a similar approach would work for isLetter, isDigit,
toUpper, toLower, etc.

One thing puzzles me, though.  Maybe someone here will have an
explanation.  I added a test case to my benchmark for isSpace
*imported* from Data.Char.  The imported isSpace benchmarks
much faster (up to 5X) than the isSpace_DataChar, even though the latter has
the same definition as the former.  Wren Thronton noticed this too,
and suggests (in
that the difference "appears to be something special in how the base
library was compiled," but I have no idea what that could be.


More information about the Libraries mailing list