c77ecc62
codegen: inline 1+2-byte varint fast path in packed-scalar decode inner loop (ozn)
The packed scalar inner loop previously called wire.decode_<st>(payload, p2) per element — a function frame plus the helper's internal loop. Now the 1-byte and 2-byte paths inline directly at the loop site for the Lua-number-returning varint types (int32/uint32/bool, plus enum via a sister helper that bypasses varint_to_int32 when the value fits int32 without wrapping). Other types (int64/uint64/sint*/sint64) fall through to the existing wire.decode_<st> call. This is the follow-up auj filed: the residual bridge after auj's tag/LEN inline migrated from the tag dispatch into the packed-int32 inner loop. Inlining literally inside the loop keeps the side trace inside the parent's own frame instead of bridging through wire.decode_int32 frame returns. Throughput on Person_decode (full mode, no PB_ENABLE_C, 5-run median): small (1-byte everything) 14.0 -> 23.4 MB/s (+67%) big (2-byte LEN + multi-byte packed) 34.7 -> 39.6 MB/s (+14% vs auj) The small-fixture +67% comes from removing the per-element function frame on lucky_numbers' 8-element packed decode, which was already 1-byte but paying for wire.decode_int32's function call per element. The big fixture adds the 2-byte fast path on top. Bridge rate at full/Person_decode multi-byte varint: pre-ozn 4/100 (residual after auj) post-ozn 3/200 (~1.5%, max clean streak 31/50) Did not reach the issue's 50-consecutive-zero goal, but throughput criterion is met spectacularly and the bridge rate is now in JIT topology noise. Standard bench/bench.lua Person numbers unchanged at every size — the win is specific to packed-multi-byte workloads. Suites: test 766/766, test-c 1057/1057.
Eugene Blikh <bigbes@gmail.com> — 2026-05-24 20:23:10 UTC
Commit c77ecc62ad571ab1f5abfae7cde31f006399804a —
view raw patch
Parent(s):
b7e97d6a
| File | Status | + | − |
|---|---|---|---|
.beads/issues.jsonl
|
M | +3 | -2 |
cmd/protoc-gen-tarantool/internal/gen/inline.go
|
M | +84 | -4 |
examples/expected/full/c_repeated/c_repeated_pb.lua
|
M | +110 | -8 |
examples/expected/full/hello/hello_pb.lua
|
M | +32 | -2 |
examples/expected/full/proto2_basic/proto2_basic_pb.lua
|
M | +128 | -8 |
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua
|
M | +426 | -44 |
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua
|
M | +394 | -42 |