feecf8e0
codegen: inline 1-byte tag fast path at decode call sites
Hoists wire.decode_tag's 1-byte fast path into every generated M.X_decode while-loop, falling back to the helper for multi-byte tags (field ids > 15). The 1-byte case covers every protobuf field with id 1..15 and is the dominant decode dispatch in real payloads. Header now localizes string.byte, bit.band, and bit.rshift so the inlined ops compile to straight local calls. Bench (Person full decode, msgs/s, median-of-3 vs proper post-h8v 3-run baseline): 10B +14.7%, 100B +8.9%, 1KB +7.5%, 10KB +7.0%, 100KB +8.5%. Full encode is flat to small (-0.1% to -2.6%) at large sizes, plausibly from header-upvalue layout. JIT trace gate: 37/37, all bridges still 0. Tests: 745/745. Also documented in bench/PERF_LOG.md, including the methodology note that h8v's earlier numbers used single-run baselines and are therefore ~3-5% optimistic; medians-of-3 are the standard now. beads-tarantool-protobuf-4kj
Eugene Blikh <bigbes@gmail.com> — 2026-05-18 18:56:10 UTC
Commit feecf8e0fd69221131d1ea4a4f10f687e80def11 —
view raw patch
Parent(s):
c85386b1
| File | Status | + | − |
|---|---|---|---|
bench/PERF_LOG.md
|
M | +94 | |
cmd/protoc-gen-tarantool/internal/gen/gen.go
|
M | +6 | |
cmd/protoc-gen-tarantool/internal/gen/inline.go
|
M | +16 | -1 |
examples/expected/full/conformance/conformance_pb.lua
|
M | +53 | -5 |
examples/expected/full/hello/hello_pb.lua
|
M | +63 | -6 |
examples/expected/full/proto2_basic/proto2_basic_pb.lua
|
M | +103 | -10 |
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua
|
M | +213 | -21 |
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua
|
M | +53 | -5 |
examples/expected/full/quickstart/quickstart_pb.lua
|
M | +13 | -1 |
examples/expected/runtime/conformance/conformance_pb.lua
|
M | +3 | |
examples/expected/runtime/hello/hello_pb.lua
|
M | +3 | |
examples/expected/runtime/proto2_basic/proto2_basic_pb.lua
|
M | +3 | |
examples/expected/runtime/protobuf_test_messages/proto2/test_messages_proto2_pb.lua
|
M | +3 | |
examples/expected/runtime/protobuf_test_messages/proto3/test_messages_proto3_pb.lua
|
M | +3 | |
examples/expected/runtime/quickstart/quickstart_pb.lua
|
M | +3 |