mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
75e6984ec8test/refactor: use test deque to avoid quadratic iteration (Lőrinc) Pull request description: Extracted from https://github.com/bitcoin/bitcoin/pull/33141#discussion_r2323012972. ----- In Python, [list `pop(0)` is linear](https://docs.python.org/3/tutorial/datastructures.html#using-lists-as-queues), so consuming all items in the test results in quadratic iteration. Switching to `collections.deque` with `popleft()` expresses FIFO intent and avoids the O(n^2) path. Behavior is unchanged - for a few hundred items the perf impact is likely negligible. ACKs for top commit: maflcko: lgtm ACK75e6984ec8theStack: re-ACK75e6984ec8enirox001: reACK75e6984w0xlt: reACK75e6984ec8Tree-SHA512: 290f6aeeb33d8b12b7acbbfede7ce0bef1c831a7ab9efc9c3a08c049986572e289cdece0844db908cf198395f574575ce4073c268033bf6dbaadc3828c96c1d8
35 KiB
Executable File
35 KiB
Executable File