perf: inflate copies matches of up to 8 bytes with two u32 moves

This commit is contained in:
4DBug committed 2026-11-01 19:31:20 -06:00
1 parent b1d9fad454
commit ddc5dd101f
1 file changed
+5 -2
@@ -404,8 +404,11 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
end
local s = op - dist
if dist >= len then
if len <= 16 and op + 16 <= cap then
-- straight-line 16-byte copy for simple LuaJIT traces; it reads only bytes before op or already copied ones
if len <= 8 and op + 8 <= cap then
-- straight-line 8- / 16-byte copies for simple LuaJIT traces; they read only bytes before op or already copied ones
writeu32(out, op, readu32(out, s))
writeu32(out, op + 4, readu32(out, s + 4))
elseif len <= 16 and op + 16 <= cap then
writeu32(out, op, readu32(out, s))
writeu32(out, op + 4, readu32(out, s + 4))
writeu32(out, op + 8, readu32(out, s + 8))