2 ms·
Detractors of UTF-8 are just wrong, period. On modern machines, main memory bandwidth gives you about 10 cycles or more per byte of input of free processing.
by ajross 18y ago
Detractors of UTF-8 are just wrong, period. On modern machines, main memory bandwidth gives you about 10 cycles or more per byte of input of free processing. It's irrelevant. And it's important to note that "how many glyphs does this string contain" is a pretty obscure question to be asking in the first place. What's the problem being solved here?
The beauty of UTF-8 is that all (all!) of the common string operations continue to work as-is without change. strlen/strdup/strcat/strcpy? Yup, same behavior. Linear search for substrings or regexes? Yup, same behavior. Alphabetic comparison? Check. Just use it, and don't mess with encodings or you will mess things up. If you don't know how it works, just trust it. If you think you know how it works and still believe it doesn't meet your requirements, you're wrong.