You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2026/09/17 19:57:00 UTC
[jira] [Updated] (THRIFT-6290) Rust: skip string/binary fields without heap-allocating
[ https://issues.apache.org/jira/browse/THRIFT-6290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Geyer updated THRIFT-6290:
-------------------------------
External issue URL: (was: https://github.com/apache/thrift/pull/3854)
> Rust: skip string/binary fields without heap-allocating
> -------------------------------------------------------
>
> Key: THRIFT-6290
> URL: https://issues.apache.org/jira/browse/THRIFT-6290
> Project: Thrift
> Issue Type: Improvement
> Components: Rust - Library
> Reporter: Santiago Medina
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> h3. Problem
> After [THRIFT-5928], {{TInputProtocol::skip()}} consumes unknown string/binary fields via {{read_bytes()}}. That is correct (no UTF-8 check), but it heap-allocates a {{Vec<u8>}} the size of the field and immediately drops it. Skipping a large unknown binary field therefore allocates on the hot path for no reason.
> h3. Proposed change
> Binary and Compact protocols should read the length prefix, still enforce negative sizes and {{max_string_size}}, then discard the payload through a small stack buffer instead of materializing it.
> A {{skip_binary()}} method on {{TInputProtocol}} lets those protocols specialize; the default implementation keeps the allocating {{read_bytes()}} path so custom protocol impls stay source-compatible.
> h3. Related
> * Follow-up to [THRIFT-5928]
> * PR: [https://github.com/apache/thrift/pull/3854]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)