-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
Line 181 slices the front off the buffer, to keep track of what's remaining:
Line 181 in 23a1b4c
| 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels