@@ 50,6 50,11 @@ M.to_int64 = to_int64
-- string.char(n) call with no cdata allocation, no `out` table, no
-- table.concat. Covers most length prefixes for short strings, many
-- enum ordinals, and most small int values in typical RPC payloads.
+--
+-- We deliberately do NOT extend the fast path to 2-4 byte values:
+-- growing the function past the LuaJIT inline budget makes parent
+-- traces stop inlining it, which costs more (~30% bench regression
+-- on 1-byte-dominant workloads) than the rare multi-byte case gains.
local function encode_varint(n)
if type(n) == 'number' and n >= 0 and n < 0x80 then
return string.char(n)