isSpace is too slow

Simon Marlow simonmarhaskell at
Mon May 21 06:22:13 EDT 2007

Neil Mitchell wrote:
> Hi
>> Want to try also the
>>     Data.ByteString.Base.isSpaceWord8 :: Word8 -> Bool
> isspace: 0.375
> iswspace: 0.400
> ByteString: 0.460
> Char: 0.672
> Not as fast as isspace/iswspace, but quite a bit faster than Char.
> Perhaps someone needs to take a peek at the generated ASM for each of
> these routines and see where the Haskell one is falling down.

Depending on the platform, iswspace might not be checking the full Unicode 
character space here: on Linux it doesn't unless you have LANG set, I think. 
The Data.Char version does support full Unicode.

That's not to say we couldn't improve things here, I'm sure we can.


More information about the Glasgow-haskell-users mailing list