From 56f8e3d878043d3a2aeec89159e836388eee4690 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Fri, 16 Oct 2026 04:35:29 -0400 Subject: [PATCH] perf: next() stops scanning at the first available proxy T3-18: _next_from_list scanned and collected every available proxy, then used only the first (8.6 ms per call at 10k proxies). break after the first; the selection order and log levels are identical (verified over full cycles with burns, dead proxies, cooldown and the all-cooling fallthrough), ~1.8 us/call at any pool size. Signed-off-by: disqualifier --- src/aioproxies/manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/aioproxies/manager.py b/src/aioproxies/manager.py index ede0cf1..aad6e1a 100644 --- a/src/aioproxies/manager.py +++ b/src/aioproxies/manager.py @@ -173,6 +173,8 @@ class AioProxies: if self._available(state["timeout"], now): fine.append(idx) self._clear_stale_burn(state) + # only the first available proxy is used; scanning on is O(pool) per call + break if fine: chosen = fine[0]