
Hi, James.
Because "String" is represented by the "[Char]", each element of String is
allocated individually. ByteString represents a string in a single array and
hasn't overhead for allocating each char.
I recommend you to read the "Real World Haskell" -
http://book.realworldhaskell.org/read/. There is some notes about
String/ByteString in the Chapter 8 -
http://book.realworldhaskell.org/read/efficient-file-processing-regular-expr...
On Sun, Apr 11, 2010 at 3:07 PM, James Fisher
Hi,
After working through a few Haskell tutorials, I've come across numerous recommendations to use the Data.ByteString library rather than standard [Char], for reasons of "performance". I'm having trouble swallowing this -- presumably the standard String is default for good reasons. Nothing has answered this question: in what case is it better to use [Char]?
Could anyone point me to a good resource showing the differences between how [Char] and ByteString are implemented, and giving good a heuristic for me to decide which is better in any one case?
Best,
James Fisher
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners