[Haskell-beginners] Re: Re: When to use ByteString rather than [Char] ... ?

Maciej Piechotka uzytkownik2 at gmail.com
Sun Apr 11 12:04:14 EDT 2010


On Sun, 2010-04-11 at 17:17 +0200, Daniel Fischer wrote:
> 
> >
> > I *guess* that in most cases the overhead on I/O will be
> sufficiently
> > great to make the difference insignificant. However:
> 
> ? which difference?
> 
> Try reading large files.

Well - while large files are not not-important IIRC most files are small
(< 4 KiB) - at least on *nix file systems (at least that's the core
'idea' of reiserfs/reiser4 filesystems).

I guess that for large strings something like text (I think I mentioned
it) is better

> Count the lines or something else, as long as it's 
> simple. The speed difference between ByteString-IO and [Char]-IO is 
> enormous.
> When you do something more complicated the difference in IO-speed may 
> become insignificant.

Hmm. As newline is a single-byte character in most encodings it is
believable. However what is the difference in counting chars (not bytes
- chars)? I wouldn't be surprise is difference was smaller.

Of course:
 - I haven't done any tests. I guessed (which I written)
 - It wasn't written what is the typical case
 - What is 'significant' difference

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20100411/5f3ac53f/attachment-0001.bin


More information about the Beginners mailing list