<div dir="ltr"><br><br><div class="gmail_quote">On Tue, Aug 17, 2010 at 1:50 PM, Yitzchak Gale <span dir="ltr">&lt;<a href="mailto:gale@sefer.org">gale@sefer.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Ketil Malde wrote:<br>
&gt; I haven&#39;t benchmarked it, but I&#39;m fairly sure that, if you try to fit a<br>
&gt; 3Gbyte file (the Human genome, say¹), into a computer with 4Gbytes of<br>
</div>&gt; RAM, UTF-16 will be slower than UTF-8...<br>
<br>
I don&#39;t think the genome is typical text. And<br>
I doubt that is true if that text is in a CJK language.<br>
<div class="im"><br>
&gt; I think that *IF* we are aiming for a single, grand, unified text<br>
&gt; library to Rule Them All, it needs to use UTF-8.<br>
<br>
</div>Given the growth rate of China&#39;s economy, if CJK isn&#39;t<br>
already the majority of text being processed in the world,<br>
it will be soon. I have seen media reports claiming CJK is<br>
now a majority of text data going over the wire on the web,<br>
though I haven&#39;t seen anything scientific backing up those claims.<br>
It certainly seems reasonable. I believe Google&#39;s measurements<br>
based on their own web index showing wide adoption of UTF-8<br>
are very badly skewed due to a strong Western bias.<br>
<br>
In that case, if we have to pick one encoding for Data.Text,<br>
UTF-16 is likely to be a better choice than UTF-8, especially<br>
if the cost is fairly low even for the special case of Western<br>
languages. Also, UTF-16 has become by far the dominant internal<br>
text format for most software and for most user platforms.<br>
Except on desktop Linux - and whether we like it or not, Linux<br>
desktops will remain a tiny minority for the foreseeable future.<br>
<div class="im"><br></div></blockquote><div> I think you are conflating two points here, and ignoring some important data. Regarding the data: you haven&#39;t actually quoted any statistics about the prevalence of CJK data, but even if the majority of web pages served are in those three languages, a fairly high percentage of the content will *still* be ASCII, due simply to the HTML, CSS and Javascript overhead. I&#39;d hate to make up statistics on the spot, especially when I don&#39;t have any numbers from you to compare them with.</div>
<div><br></div><div>As far as the conflation, there are two questions with regard to the encoding choice: encoding/decoding time and space usage. I don&#39;t think *anyone* is asserting that UTF-16 is a common encoding for files anywhere, so by using UTF-16 we are simply incurring an overhead in every case. We can&#39;t consider a CJK encoding for text, so its prevalence is irrelevant to this topic. What *is* relevant is that a very large percentage of web pages *are*, in fact, standardizing on UTF-8, and that all 7-bit text files are by default UTF-8.</div>
<div><br></div><div>As far as space usage, you are correct that CJK data will take up more memory in UTF-8 than UTF-16. The question still remains whether the overall document size will be larger: I&#39;d be interested in taking a random sampling of CJK-encoded pages and comparing their UTF-8 and UTF-16 file sizes. I think simply talking about this in the vacuum of data is pointless. If anyone can recommend a CJK website which would be considered representative (or a few), I&#39;ll do the test myself.</div>
<div><br></div><div>Michael</div></div></div>