~bigbes/tarantool-protobuf: 9ee21c09

codegen: inline 1-byte varint length prefix at every LEN emit site

Eliminates the wire.encode_varint(#body) call + dispatch for every
length-delimited field in mode=full codegen. Profile flagged the
out[n] = wire.encode_varint(#_b) line as ~33% of hello.Person 1KB
encode time, with another ~17% in encode_varint dispatch — together
~50% of encode time. Lifting the 1-byte fast path (the dominant case
for proto strings and small message bodies) to the call site removes
the function frame entirely for lengths < 128.

Applied at every LEN emit site: singular/repeated message body,
singular/repeated string|bytes, packed scalar bundle, packed enum
bundle, map entry. Map value pieces (emitMapPiece message branch)
left as-is — they sit inside a single slot assignment that would
require a deeper restructure, and maps are not on the current hot
benchmark.

Results (hello.Person full encode, msgs/s): 10B +6.9%, 100B +7.9%,
1KB +25.7%, 10KB +48.1%, 100KB +31.9%. Decode flat (unchanged path).
Runtime mode flat (descriptor dispatch still calls encode_varint).
JIT trace gate: 37/37. Test suite: 745/745.

Bench history saved to bench/PERF_LOG.md with full numbers and the
workflow this iteration follows.

beads-tarantool-protobuf-h8v

Eugene Blikh <bigbes@gmail.com> — 2026-05-18 18:31:45 UTC

Commit 9ee21c091d83431b7490d4ea3960df4b33f5f65cview raw patch

Parent(s): 07eef11c

8 changed file(s)

FileStatus+
bench/PERF_LOG.md A +170
cmd/protoc-gen-tarantool/internal/gen/inline.go M +34 -9
examples/expected/full/conformance/conformance_pb.lua M +114 -19
examples/expected/full/hello/hello_pb.lua M +174 -28
examples/expected/full/proto2_basic/proto2_basic_pb.lua M +66 -11
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua M +522 -80
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +632 -99
examples/expected/full/quickstart/quickstart_pb.lua M +12 -2