[Haskell-beginners] When to use ByteString rather than [Char]
...?
Stephen Tetley
stephen.tetley at gmail.com
Sun Apr 11 11:15:22 EDT 2010
On 11 April 2010 15:42, Daniel Fischer <daniel.is.fischer at web.de> wrote:
[SNIP]
> When dealing with short strings, in my experience there are rarely
> compelling reasons to choose one over the other.
Hi Daniel
Thanks - I was slightly surprised at the results in the paper because
the 'cons' test for was equal, I thought bytestrings have to do a bit
more work for a 'cons' - looking at the code lazy bytestring uses one
constructor and a bit of C memory poking, which is the C memory poking
more than I'd expect the [Char] version to do.
The only 'determinant' I've found for choosing which type for short
strings is if I'm using a library that forces one or the other on me,
otherwise I'm swayed by the simplicity of [Char].
Best wishes
Stephen
More information about the Beginners
mailing list