<div class="gmail_quote">On Tue, Aug 17, 2010 at 9:08 AM, Ketil Malde <span dir="ltr">&lt;<a href="mailto:ketil@malde.org">ketil@malde.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Benedikt Huber &lt;<a href="mailto:benjovi@gmx.net">benjovi@gmx.net</a>&gt; writes:<br>
<br>
&gt; Despite of all this, I think the performance of the text<br>
&gt; package is very promising, and hope it will improve further!<br>
<br>
I agree, Data.Text is great.  Unfortunately, its internal use of UTF-16<br>
makes it inefficient for many purposes.<br></blockquote><div><br>It&#39;s not clear to me that using UTF-16 internally does make Data.Text noticeably slower. If we could get conclusive evidence that using UTF-16 hurts performance, we could look into changing the internal representation (a major undertaking). What Bryan and I need is benchmarks showing where Data.Text is performing poorly, compare to String or ByteString, so we can investigate the cause(s).<br>

<br>Hypothesis are a good starting point for performance improvements, but they&#39;re not enough. We need benchmarks and people looking at profiling and compiler output to really understand what&#39;s going on. For example, how many know that the Handle implementations copies the input first into a mutable buffer and then into a Text value, for reads less than the buffer size (8k if I remember correctly). One of these copies could be avoided. How do we know that it&#39;s using UTF-16 that&#39;s our current performance bottleneck and not this extra copy? We need to benchmark, change the code, and then benchmark again.<br>

<br>Perhaps the outcome of all the benchmarking and investigation is indeed that UTF-16 is a problem; then we can change the internal encoding. But there are other possibilities, like poorly laid out branches in the generated code. We need to understand what&#39;s going on if we are to make progress.<br>

<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

A large fraction - probably most - textual data isn&#39;t natural language<br>
text, but data formatted in textual form, and these formats are<br>
typically restricted to ASCII (except for a few text fields).<br>
<br>
For instance, a typical project for me might be 10-100GB of data, mostly<br>
in various text formats, &quot;real&quot; text only making up a few percent of<br>
this.  The combined (all languages) Wikipedia is 2G words, probably less<br>
than 20GB.<br></blockquote><div><br>I think this is an important observation.<br><br>Cheers,<br>Johan<br><br></div></div>