Implement zero-copy for strings in base API calls (#10851)
This commit is contained in:
1 parent
cd7922faaf
commit
d0d7abb542
8 files changed
+62
-26
No files matched your search
@@ -373,6 +373,14 @@ def create_field_type_info(
|
||||
# Traditional fixed array approach with copy
|
||||
return FixedArrayBytesType(field, fixed_size)
|
||||
|
||||
# Check for pointer_to_buffer option on string fields
|
||||
if field.type == 9:
|
||||
has_pointer_to_buffer = get_field_opt(field, pb.pointer_to_buffer, False)
|
||||
|
||||
if has_pointer_to_buffer:
|
||||
# Zero-copy pointer approach for strings
|
||||
return PointerToBytesBufferType(field, None)
|
||||
|
||||
# Special handling for bytes fields
|
||||
if field.type == 12:
|
||||
return BytesType(field, needs_decode, needs_encode)
|
||||
|
||||
Reference in new issue
Block a user