From 94e7bb87bce6821e91734f1fcbb6cfd61a008049 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Thu, 1 Oct 2026 08:52:43 +0100 Subject: Push a turn's sends to a link at once, and round only the links that want one (017, 2b-1) The sending loop was woken by every record queued while it slept: the owner queues one by one, the loop caught up and slept between them, and every link took a round on every wake. Four links sent 64k packets of 12 records where threads sent 40k of 20, and ran at 257k sends/s against 581k. The owner now queues a turn's sends and pushes each link once; the loop rounds a link only when its socket has answers, it was pushed, or its time came. --- serve/serve.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'serve') diff --git a/serve/serve.c b/serve/serve.c index b5112d2..86e38f8 100644 --- a/serve/serve.c +++ b/serve/serve.c @@ -1829,6 +1829,7 @@ static void feed_outlets(Executor *ex) { delivered = wire ? pure_wire_delivered(wire) : link ? pure_link_delivered(link) : local_delivered(local); size_t held = wire ? pure_wire_held(wire) : link ? pure_link_held(link) : local_held(local), at = ex->outlet_from[i]; at = at > gone ? at - (size_t)gone : 0; + uint64_t before = queued; for (; at < ex->app.sent_saved; ++at) { uint32_t of; uint64_t seq; @@ -1844,6 +1845,7 @@ static void feed_outlets(Executor *ex) { queued = seq; held += payload.size; } + if (link && queued != before) pure_link_push(link); /* the turn's together */ ex->outlet_from[i] = at; } uint64_t now = ex->local_count ? now_ms() : 0; -- cgit v1.2.3