[Haskell-cafe] Re: String vs ByteString

Johan Tibell johan.tibell at gmail.com
Tue Aug 17 05:06:30 EDT 2010


Hi Bulat,

On Tue, Aug 17, 2010 at 10:34 AM, Bulat Ziganshin <bulat.ziganshin at gmail.com
> wrote:

>  > It's not clear to me that using UTF-16 internally does make
> > Data.Text noticeably slower.
>
> not slower but require 2x more memory. speed is the same since
> Unicode contains 2^20 codepoints
>

Yes, in theory a program could use as much as 2x the memory. That being
said, most programs don't hold that much text data in memory at any given
point so that might be 2x of a small number. One experiment [1] found it
difficult to show any difference in memory usage at all in Trac when
switching Python's internal representation from UCS2 to UCS4.

So it's not clear to me that using UTF-16 makes the program noticeably
slower or use more memory on a real program.

1. http://www.cmlenz.net/archives/2008/07/the-truth-about-unicode-in-python

Cheers,
Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100817/287d9700/attachment.html


More information about the Haskell-Cafe mailing list