# HG changeset patch # User Kim Alvefur # Date 1626305924 -7200 # Node ID d6be4dda1f60743318fa629d6c4d917dbcd064c0 # Parent 7c03b1f4c3887c081735380368a41946bedf162b net.server_epoll: Set minimum wait time to 1ms, matching epoll A timeout value less than 0.001 gets turned into zero on the C side, so epoll_wait() returns instantly and essentially busy-loops up to 1ms, e.g. when a timer event ends up scheduled (0, 0.001)ms into the future. Unsure if this has much effect in practice, but it may waste a small amount of CPU time. How much would depend on how often this ends up happening and how fast the CPU gets trough main loop iterations. diff -r 7c03b1f4c388 -r d6be4dda1f60 net/server_epoll.lua --- a/net/server_epoll.lua Thu Jul 15 00:38:27 2021 +0200 +++ b/net/server_epoll.lua Thu Jul 15 01:38:44 2021 +0200 @@ -65,7 +65,7 @@ -- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers) max_wait = 86400; - min_wait = 1e-06; + min_wait = 0.001; -- Enable extra noisy debug logging -- TODO disable once considered stable