e3f06741
runtime: pb.decode_unsafe + M.<Name>_decode_unsafe in runtime mode (58u)
Completes the unsafe-decode story 6bb started in full mode. Runtime mode now exposes the same API via parallel `f._reader_unsafe` closures compiled in pb.finalize_message against a swapped scalar table where `string` maps to the bytes handler (no utf8_len). build_reader / build_repeated_reader / decode_one are now parameterized on (scalar_tbl, decode_msg_fn, decode_group_fn) so the same builders emit both reader shapes. decode_message_unsafe, decode_group_unsafe, and decode_extension_unsafe are literal clones of their safe twins with three substitutions (documented in codec.lua): the _reader field, the scalar table in slow paths, and the sub-message / group / extension dispatchers. Tests in test/decode_unsafe_test.lua are now parameterized over both modes (14 cases, including a map<string, int32> invalid-key case that exercises the decode_one map-fallback path). Runtime-mode microbench shows ~8% throughput vs validating decode on the string-heavy 1KB Person; smaller than full mode's ~20% because the descriptor dispatch + closure indirection swamp utf8_len, but still a net win and the perf-cost-of-validating story is now consistent across modes. Conformance 3240/3240 + JIT trace 37/37 still pass. Closes 58u, also closes b12 (already fixed in 2656c97; never closed). kyt still tracks unifying _decode_unsafe with C accel.
Eugene Blikh <bigbes@gmail.com> — 2026-05-24 19:11:39 UTC
Commit e3f067416da55e4390d1a9b3e1f410ad7a48d22f —
view raw patch
Parent(s):
53840866
| File | Status | + | − |
|---|---|---|---|
.beads/interactions.jsonl
|
M | +2 | |
.beads/issues.jsonl
|
M | +4 | -2 |
cmd/protoc-gen-tarantool/internal/gen/gen.go
|
M | +6 | |
docs/api-modes.md
|
M | +10 | -3 |
examples/expected/runtime/c_int64/c_int64_pb.lua
|
M | +1 | |
examples/expected/runtime/c_nested/c_nested_pb.lua
|
M | +5 | |
examples/expected/runtime/c_repeated/c_repeated_pb.lua
|
M | +2 | |
examples/expected/runtime/conformance/conformance_pb.lua
|
M | +5 | |
examples/expected/runtime/hello/hello_pb.lua
|
M | +6 | |
examples/expected/runtime/proto2_basic/proto2_basic_pb.lua
|
M | +10 | |
examples/expected/runtime/protobuf_test_messages/proto2/test_messages_proto2_pb.lua
|
M | +21 | |
examples/expected/runtime/protobuf_test_messages/proto3/test_messages_proto3_pb.lua
|
M | +5 | |
examples/expected/runtime/quickstart/quickstart_pb.lua
|
M | +1 | |
runtime/pb/codec.lua
|
M | +336 | -19 |
runtime/pb/init.lua
|
M | +15 | |
test/decode_unsafe_test.lua
|
M | +103 | -84 |