[Python-Dev] O(1) deletes from the front of bytearray (was: Re: Adding bytes.frombuffer() constructor to PEP 467 (was: [Python-ideas] Adding bytes.frombuffer() constructor)
Jeff Allen
ja.py at farowl.co.uk
Thu Oct 13 19:28:39 EDT 2016
On 13/10/2016 11:41, Serhiy Storchaka wrote:
> On 13.10.16 00:14, Nathaniel Smith wrote:
>> AFAIK basically the only project that would be affected by this is
>> PyPy,
>
> And MicroPython.
>
And Jython, except that from the start its implementation of bytearray
deferred resizing until the proportion unused space reaches some limit.
I think that should make it O(log N) on average to delete (or add) a
byte, at either end of a buffer of size N,. However, observations with
timeit() look constant up to the point I run out of heap.
Jeff Allen
More information about the Python-Dev
mailing list