Line 181 slices the front off the buffer, to keep track of what's remaining:
|
self._buffer = self._buffer[can_consume:] |
This operation is O(n), since the python runtime must make a new copy of the data. Since this repeats O(n) times, the overall complexity is O(n^2). This gets particularly noticeable for larger inputs (>1MB).
I suggest either using an io.BytesIO object, or simply keeping track of an index into the buffer.
Line 181 slices the front off the buffer, to keep track of what's remaining:
pyaes/pyaes/blockfeeder.py
Line 181 in 23a1b4c
This operation is O(n), since the python runtime must make a new copy of the data. Since this repeats O(n) times, the overall complexity is O(n^2). This gets particularly noticeable for larger inputs (>1MB).
I suggest either using an
io.BytesIOobject, or simply keeping track of an index into the buffer.