Improving Data.Char.isSpace performance

Simon Peyton-Jones simonpj at microsoft.com
Mon Oct 29 23:29:08 CET 2012


|  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.

A way to reproduce this would be good.  (If so, open a ticket.)  The only thing I can think of is that libraries may be compiled with -O2, and that might make a difference.

Simon

|  -----Original Message-----
|  From: libraries-bounces at haskell.org [mailto:libraries-bounces at haskell.org] On
|  Behalf Of John MacFarlane
|  Sent: 28 October 2012 23:35
|  To: Edward A Kmett
|  Cc: libraries at haskell.org
|  Subject: Re: Improving Data.Char.isSpace performance
|  
|  +++ 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
|  
|  
|  _______________________________________________
|  Libraries mailing list
|  Libraries at haskell.org
|  http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list