Improving Data.Char.isSpace performance

John MacFarlane jgm at berkeley.edu
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
http://community.haskell.org/~wren/bytestring-lexing/test/bench/BenchIsSpace.hs)
that the difference "appears to be something special in how the base
library was compiled," but I have no idea what that could be.

John




More information about the Libraries mailing list