~bigbes/tarantool-protobuf: 2656c977

bench,codec: pin proto2 paths, kill pairs() on extension hot path

JIT trace gate gains 12 proto2-specific checks (required encode/decode,
groups singular + repeated, extension encode/decode). The extension-encode
check fired NYI on bytecode 72 (ISNEXT) — pairs() over the new
extensions_by_full_name hash is the same trace-abort that gates map
encode. Fix: register_extension now also appends to extensions_list,
an array view. codec.encode_message, text.emit_message and
json.encode_message all switch to ipairs over the list. Hash tables
stay around for O(1) lookups in decode (extensions_by_id) and bracket-
name resolution (extensions_by_full_name).

Inline (full-mode) codegen learns to walk extensions too: before this
commit the inline encoder skipped t._extensions entirely (only the
runtime codec walked it), so a generated _encode silently dropped any
extension data set on the message. Add the array-walk after the field
loop and a decode_extension dispatch in the unknown-tag branch — the
inline path now matches runtime byte-for-byte.

bench/bench.lua parameterizes over a FIXTURES list so the baseline can
cover both hello.Person and a new proto2_basic.BenchPayload fixture
(required + group + extension + repeated). baseline.json restructured
under "schemas": [{schema, results}, …]; compare walks both. Fresh
numbers committed.

740/740 luatest cases pass; JIT gate 37/37; conformance 2806 binary+JSON
and 434 text-format, both 0 failures.

Eugene Blikh <bigbes@gmail.com> — 2026-05-17 07:11:31 UTC

Commit 2656c977e43bd649d9ac766cec637c6733706478view raw patch

Parent(s): 79efcdc9

17 changed file(s)

FileStatus+
bench/baseline.json M +49 -28
bench/bench.lua M +193 -84
bench/jit_trace.lua M +70
cmd/protoc-gen-tarantool/internal/gen/inline.go M +39 -3
examples/expected/full/conformance/conformance_pb.lua M +115 -15
examples/expected/full/hello/hello_pb.lua M +138 -18
examples/expected/full/proto2_basic/proto2_basic_pb.lua M +624 -21
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua M +483 -63
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +115 -15
examples/expected/full/quickstart/quickstart_pb.lua M +23 -3
examples/expected/runtime/proto2_basic/proto2_basic_pb.lua M +157
runtime/pb/codec.lua M +21 -9
runtime/pb/init.lua M +11 -2
runtime/pb/json.lua M +11 -7
runtime/pb/text.lua M +12 -8
test/proto/proto2_basic.proto M +29
test/proto2_test.lua M +46