~bigbes/tarantool-protobuf: b09c7213

codegen: inline 1-byte LEN fast path for string/bytes decode

Singular and repeated string/bytes fields in generated full-mode _decode
now read the length byte and dispatch in-line instead of calling
wire.decode_string / wire.decode_bytes. For length < 128 (the common
short-string RPC case), the path stays inside the parent JIT trace:
no child-trace stitch, no per-element function frame, utf8_len lookup
hoisted to a generated-file upvalue.

The original a6n design — one ffi.cast(U8CP, buf) at the top of each
_decode — was abandoned: the cdata wrapper is 24 bytes per call and
LuaJIT can't sink the allocation because the pointer local lives
across wire.decode_* call frames. Net regression at small sizes
(+11-16%) overwhelmed the single-byte-read savings.

Bench (hello.Person full-mode decode):

      size    ns/op before   ns/op after   delta
      10B          419            390     -6.9%
      100B         515            478     -7.2%
      1KB         9004           8042    -10.7%
      10KB       64644          56745    -12.2%
      100KB     625638         537750    -14.0%

Zero allocation impact across all sizes. Tests: 1043 pass, 37 JIT
trace gates pass. (a6n)

Eugene Blikh <bigbes@gmail.com> — 2026-05-23 21:39:08 UTC

Commit b09c7213874b18bd0f8d1c4d60d3ec8253f1be6dview raw patch

Parent(s): ee07048d

20 changed file(s)

FileStatus+
cmd/protoc-gen-tarantool/internal/gen/gen.go M +1
cmd/protoc-gen-tarantool/internal/gen/inline.go M +58 -6
examples/expected/full/c_int64/c_int64_pb.lua M +1
examples/expected/full/c_nested/c_nested_pb.lua M +1
examples/expected/full/c_repeated/c_repeated_pb.lua M +42 -9
examples/expected/full/conformance/conformance_pb.lua M +237 -51
examples/expected/full/hello/hello_pb.lua M +140 -30
examples/expected/full/proto2_basic/proto2_basic_pb.lua M +84 -18
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua M +303 -66
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +138 -30
examples/expected/full/quickstart/quickstart_pb.lua M +29 -6
examples/expected/runtime/c_int64/c_int64_pb.lua M +1
examples/expected/runtime/c_nested/c_nested_pb.lua M +1
examples/expected/runtime/c_repeated/c_repeated_pb.lua M +1
examples/expected/runtime/conformance/conformance_pb.lua M +1
examples/expected/runtime/hello/hello_pb.lua M +1
examples/expected/runtime/proto2_basic/proto2_basic_pb.lua M +1
examples/expected/runtime/protobuf_test_messages/proto2/test_messages_proto2_pb.lua M +1
examples/expected/runtime/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +1
examples/expected/runtime/quickstart/quickstart_pb.lua M +1