flaming vs accuracy [was Re: Performance of int/long in Python 3]

MRAB python at mrabarnett.plus.com
Thu Mar 28 15:51:56 CET 2013


On 28/03/2013 12:11, Neil Hodgson wrote:
> Ian Foote:
>
>> Specifically, indexing a variable-length encoding like utf-8 is not
>> as efficient as indexing a fixed-length encoding.
>
> Many common string operations do not require indexing by character
> which reduces the impact of this inefficiency. UTF-8 seems like a
> reasonable choice for an internal representation to me. One benefit
> of UTF-8 over Python's flexible representation is that it is, on
> average, more compact over a wide set of samples.
>
Implementing the regex module (http://pypi.python.org/pypi/regex) would
have been more difficult if the internal representation had been UTF-8,
because of the need to decode, and the implementation would also have
been slower for that reason.



More information about the Python-list mailing list