szn

Bug 303 — renderToDisplayClient calls anyDisplayClientBehind() multiple times per loop

303. anyDisplayClientBehind() called 3+ times per render loop

File: src/server/server.zig:686, 2536, 2562, 2585, 2619 Severity: LOW Status: ✅ FIXED

Called:

That is up to 5 traversals of the display_clients list per loop iteration. With 1-4 clients this is negligible, but it is wasteful.

Fix: Cache the result. Add a behind_count: u32 field to Server that is incremented when a client behind transitions to true and decremented when it transitions to false. anyDisplayClientBehind() becomes self.behind_count > 0.