# HG changeset patch # User Kim Alvefur # Date 1626442808 -7200 # Node ID 9a2a98621c73bf60b9ce8595d3fe89aa69f5db27 # Parent 6c3d8aa3bbd9f2bbf5339b95bbe94bb6db4454d8 net.server_epoll: Optimize concatenation of exactly 2 buffer chunks Saves a function call. I forget if I measured this kind of thing but IIRC infix concatenation is faster than a function call up to some number of items, but let's stop at 2 here. diff -r 6c3d8aa3bbd9 -r 9a2a98621c73 net/server_epoll.lua --- a/net/server_epoll.lua Fri Jul 16 15:38:38 2021 +0200 +++ b/net/server_epoll.lua Fri Jul 16 15:40:08 2021 +0200 @@ -473,8 +473,10 @@ local buffer = self.writebuffer; local data = buffer or ""; if type(buffer) == "table" then - if buffer[2] then + if buffer[3] then data = t_concat(data); + elseif buffer[2] then + data = buffer[1] .. buffer[2]; else data = buffer[1] or ""; end