Skip to content

Conversation

@willcl-ark
Copy link
Owner

test PR

Extracted from bitcoin#33141 (comment).
In Python, list `pop(0)` is linear, so consuming all items is quadratic.
Switched to `collections.deque` with `popleft()` to express FIFO intent and avoid the O(n^2) path.
Behavior is unchanged; for a few hundred items the perf impact is likely negligible.

Ref: https://docs.python.org/3/tutorial/datastructures.html#using-lists-as-queues
> While appends and pops from the end of list are fast, doing inserts or pops
> from the beginning of a list is slow (because all of the other elements have
> to be shifted by one).
@github-actions github-actions bot force-pushed the master branch 2 times, most recently from a5d742e to acc041c Compare October 31, 2025 23:54
@willcl-ark willcl-ark force-pushed the master branch 2 times, most recently from 37a6a6d to 4cdce02 Compare November 5, 2025 22:25
@github-actions github-actions bot force-pushed the master branch 4 times, most recently from 6a31544 to acff675 Compare November 11, 2025 23:54
@willcl-ark willcl-ark force-pushed the master branch 9 times, most recently from ed138e2 to 2ccfcf2 Compare November 20, 2025 23:55
@willcl-ark willcl-ark force-pushed the master branch 3 times, most recently from 425aeb2 to 9827b14 Compare November 28, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants