a6eebdb3
codegen: local counter per repeated field on decode
Replaces `list[#list + 1] = val` with `_n_<fname> = _n_<fname> + 1; list[_n_<fname>] = val` in every generated M.X_decode repeated-field append site. One counter local per repeated non-map field, declared at function entry. Counters survive across loop iterations so out-of-order wire entries for the same field continue past the existing length without re-scanning. Profile attributed 6.2% of hello.Person 1KB decode to the `#list + 1` re-traversal (26-email Person paid 26 list scans per decode). Bench (Person full decode, msgs/s, median-of-3 vs post-4kj): 1KB +5.0%, 10KB +5.0%, 100KB +7.1%. Encode flat. Tests 745/745. JIT 37/37, 0 bridges. beads-tarantool-protobuf-cch
Eugene Blikh <bigbes@gmail.com> — 2026-05-18 19:01:08 UTC
Commit a6eebdb3698c166bfb1618023e6ce85b0f7911fd —
view raw patch
Parent(s):
feecf8e0
| File | Status | + | − |
|---|---|---|---|
bench/PERF_LOG.md
|
M | +53 | |
cmd/protoc-gen-tarantool/internal/gen/inline.go
|
M | +19 | -7 |
examples/expected/full/conformance/conformance_pb.lua
|
M | +2 | -1 |
examples/expected/full/hello/hello_pb.lua
|
M | +7 | -4 |
examples/expected/full/proto2_basic/proto2_basic_pb.lua
|
M | +16 | -10 |
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua
|
M | +146 | -95 |
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua
|
M | +175 | -109 |
examples/expected/full/quickstart/quickstart_pb.lua
|
M | +2 | -1 |