Why is b.pop(0) over 200 times slower than del b[0] for bytearray?
When you run b.pop(0), Python moves all the elements back by one as you might expect. This takes O(n) time. When you del b[0], Python simply increases the start pointer of the object by 1. In both cases, PyByteArray_Resize is called to adjust the size. When the new size is smaller than half the allocated … Read more