diff --git a/runtime/pb/wire.lua b/runtime/pb/wire.lua index 8e21add2974bcf573c114e2a3e54985a02ab8890..0b6046da420859ef5c600248b20adde1a77ef285 100644 --- a/runtime/pb/wire.lua +++ b/runtime/pb/wire.lua @@ -50,6 +50,11 @@ -- Fast path: small non-negative Lua numbers (0..127) become a single -- 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)