Performance of int/long in Python 3

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Apr 2 04:35:30 EDT 2013


On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:

> On Tue, Apr 2, 2013 at 6:24 PM, jmfauth <wxjmfauth at gmail.com> wrote:
>> An editor may reflect very well the example a gave. You enter thousand
>> ascii chars, then - boum - as you enter a non ascii char, your editor
>> (assuming is uses a mechanism like the FSR), has to internally reencode
>> everything!
> 
> That assumes that the editor stores the entire buffer as a single Python
> string. Frankly, I think this unlikely; the nature of insertions and
> deletions makes this impractical. (I've known editors that do function
> this way. They're utterly unusable on large files.)

Nevertheless, for *some* size of text block (a word? line? paragraph?) an 
implementation may need to re-encode the block as characters are inserted 
or deleted.

So what? Who cares if it takes 0.00002 second to insert a character 
instead of 0.00001 second? That's still a hundred times faster than you 
can type.


-- 
Steven



More information about the Python-list mailing list