fix performance regression of #receive_requests recent loop change

the recent change to be able to resend multiple requests at a time on the same loop handling block made the complexity of it spike to O(n), where every request needs to be checked, including requests which have already completed. benchmarks runs with 5k requests, and the impact was noticeable enough.

this change fixes it by keeping a record of pending requests, where the list is drained as requests are completed; the loop is also short-circuited on the first pending request. this change improves a lot the handling of HTTP/1.1 multiple requests, as they're ordered, which means that there's a guarantee that no other request completed beyond the pending one, it's however suboptimal for HTTP/2 connections, where requests may arrive out-of-order, which may introduce delay in triggering resending requests and other callbacks.

Merge request reports

Loading