~bigbes/tarantool-protobuf: ff1ce60f

c_runtime: decode_unsafe(plan, buf) entrypoint, skip_utf8 gate on dec_ctx (kyt)

Before this change, M.<Msg>_decode_unsafe stayed on the inline Lua path even
when PB_ENABLE_C=1, because c_runtime.decode validated UTF-8 unconditionally.
Now both safe and unsafe decoders dispatch to the C runtime; the unsafe path
calls c_runtime.decode_unsafe, which sets dec_ctx.skip_utf8 and gates the
is_valid_utf8 call on every PB_KIND_STRING payload across the decode tree.

pb.decode_unsafe in init.lua mirrors pb.decode: tries desc.c_plan first, falls
back to the pure-Lua decode_msg_unsafe. Full-mode codegen emits the same
pb.c_runtime check at the unsafe prologue.

Perf on string-heavy Person (418B, 16 emails + 16 nicknames):
  Lua  unsafe  142 MB/s
  C    safe    364 MB/s
  C    unsafe  455 MB/s   (+25% over C-safe, 3.2x over Lua-unsafe)

Suites: test 766/766, test-c 1057/1057, examples all green.

Eugene Blikh <bigbes@gmail.com> — 2026-05-24 19:48:47 UTC

Commit ff1ce60f7c0d09476ff860eded449af87071fb66view raw patch

Parent(s): e3f06741

13 changed file(s)

FileStatus+
.beads/issues.jsonl M +2 -2
cmd/protoc-gen-tarantool/internal/gen/inline.go M +10 -10
examples/expected/full/c_int64/c_int64_pb.lua M +4
examples/expected/full/c_nested/c_nested_pb.lua M +20
examples/expected/full/c_repeated/c_repeated_pb.lua M +8
examples/expected/full/conformance/conformance_pb.lua M +20
examples/expected/full/hello/hello_pb.lua M +24
examples/expected/full/proto2_basic/proto2_basic_pb.lua M +40
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua M +84
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +20
examples/expected/full/quickstart/quickstart_pb.lua M +4
runtime/pb/c/c_runtime.c M +36 -7
runtime/pb/init.lua M +23 -13