~bigbes/tarantool-protobuf: 0fb62135

codegen: localize wire.* upvalues per generated message function

Capture each _encode/_decode body, scan for wire.<name> refs, and
rewrite refs that appear >=2 times to bare locals with a
"local X = wire.X" prelude. Single-use refs stay as wire.X — without
the threshold the prelude TGETS outweighed the in-body saving on
sparse small-message decode.

Measured (median-of-3, shapes bench full mode):
- scalar-heavy: enc +38.5%, dec +39.2%
- packed-int32x100: enc +51.1%, dec +38.2%
- map-strxi32-*: enc +5.5%, dec +6-7%
- nested/oneof/wkt: +1-5% (within ~5% variance band)
- bench.lua Person small sizes: neutral

closes kot

Eugene Blikh <bigbes@gmail.com> — 2026-05-24 05:40:42 UTC

Commit 0fb62135cea8c822c59c17cd6676697ab5304dd7view raw patch

Parent(s): 5de883e9

11 changed file(s)

FileStatus+
.beads/interactions.jsonl M +1
.beads/issues.jsonl M +1 -1
cmd/protoc-gen-tarantool/internal/gen/gen.go M +25 -2
cmd/protoc-gen-tarantool/internal/gen/inline.go M +208 -135
examples/expected/full/c_repeated/c_repeated_pb.lua M +69 -55
examples/expected/full/conformance/conformance_pb.lua M +48 -39
examples/expected/full/hello/hello_pb.lua M +92 -77
examples/expected/full/proto2_basic/proto2_basic_pb.lua M +57 -43
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua M +695 -617
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +589 -553
examples/expected/full/quickstart/quickstart_pb.lua M +9 -6