53840866
codegen: emit <Msg>_decode_unsafe for trusted-source decoding (6bb)
Full-mode codegen now emits a sister <Msg>_decode_unsafe(buf) alongside <Msg>_decode that drops the per-string utf8_len check (singular, repeated, map keys/values, extensions, and the >=128-byte fallback all route through wire.decode_bytes). Sub-messages recurse into their own _decode_unsafe so nested strings also bypass; WKTs continue to call the normal pb.wkt.<Name>_decode (no _unsafe twin, no string-validation hot path). C runtime dispatch is skipped because it validates today (kyt). Use this when re-decoding bytes from a trusted producer — your own encoder over typed RPC, JSON/text round-trips, in-process pipelines — where the spec-required utf8.len check on every string is duplicate work. Microbench on a string-heavy 1KB Person (26 emails) shows ~20% throughput vs _decode; conformance suite still passes (3240/3240) because _decode itself is unchanged. Runtime mode does not yet expose _decode_unsafe (compiled f._reader closures capture handler.decode by value, so a runtime swap wouldn't reach them); tracked in 58u.
Eugene Blikh <bigbes@gmail.com> — 2026-05-24 18:54:03 UTC
Commit 53840866a6ef3349d42bf589a6646aaad6869386 —
view raw patch
Parent(s):
dbbfaf35
| File | Status | + | − |
|---|---|---|---|
.beads/interactions.jsonl
|
M | +1 | |
.beads/issues.jsonl
|
M | +1 | -1 |
cmd/protoc-gen-tarantool/internal/gen/inline.go
|
M | +101 | -36 |
docs/api-modes.md
|
M | +34 | |
examples/expected/full/c_int64/c_int64_pb.lua
|
M | +59 | |
examples/expected/full/c_nested/c_nested_pb.lua
|
M | +251 | |
examples/expected/full/c_repeated/c_repeated_pb.lua
|
M | +388 | |
examples/expected/full/conformance/conformance_pb.lua
|
M | +554 | |
examples/expected/full/hello/hello_pb.lua
|
M | +571 | |
examples/expected/full/proto2_basic/proto2_basic_pb.lua
|
M | +697 | |
examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua
|
M | +3193 | |
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua
|
M | +2120 | |
examples/expected/full/quickstart/quickstart_pb.lua
|
M | +79 | |
test/decode_unsafe_test.lua
|
A | +99 |