RE Module Performance
python at mrabarnett.plus.com
Tue Jul 30 19:14:55 CEST 2013
On 30/07/2013 17:39, Antoon Pardon wrote:
> Op 30-07-13 18:13, MRAB schreef:
>> On 30/07/2013 15:38, Antoon Pardon wrote:
>>> Op 30-07-13 16:01, wxjmfauth at gmail.com schreef:
>>>> I am pretty sure that once you have typed your 127504 ascii
>>>> characters, you are very happy the buffer of your editor does not
>>>> waste time in reencoding the buffer as soon as you enter an €, the
>>>> 125505th char. Sorry, I wanted to say z instead of euro, just to
>>>> show that backspacing the last char and reentering a new char
>>>> implies twice a reencoding.
>>> Using a single string as an editor buffer is a bad idea in python for
>>> the simple reason that strings are immutable.
>> Using a single string as an editor buffer is a bad idea in _any_
>> language because an insertion would require all the following
>> characters to be moved.
> Not if you use a gap buffer.
The disadvantage there is that when you move the cursor you must move
characters around. For example, what if the cursor was at the start and
you wanted to move it to the end? Also, when the gap has been filled,
you need to make a new one.
More information about the Python-list