[Haskell-cafe] Re: String vs ByteString

Daniel Fischer daniel.is.fischer at web.de
Fri Aug 13 14:57:07 EDT 2010

On Friday 13 August 2010 19:53:37 you wrote:
> On Fri, Aug 13, 2010 at 9:55 AM, Daniel Fischer 
<daniel.is.fischer at web.de>wrote:
> > That's an unfortunate example. Using the stringsearch package,
> > substring searching in ByteStrings was considerably faster than in
> > Data.Text in my tests.
> Interesting. Got a test case so I can repro and fix? :-)

Just occurred to me, a lot of the difference is due to the fact that text 
has to convert a ByteString to Text on reading the file, so I timed that by 
reading the file and counting the chunks, that took text 0.21s for big.txt 
vs. Data.ByteString.Lazy's 0.01s.
So for searching in-memory strings, subtract about 0.032s/MB from the 
difference - it's still large.

More information about the Haskell-Cafe mailing list