haohuaijin opened a new issue, #11396:
URL: https://github.com/apache/arrow-rs/issues/11396
### Is your feature request related to a problem or challenge?
`Variant::String`, `Variant::ShortString`, and object field names currently
use `serde_json::to_string` to create a temporary String, then copy it into the
output writer:
```rust
let json_str = serde_json::to_string(s)?;
write!(buffer, "{json_str}")?;
```
This introduces an unnecessary allocation and copy.
### Describe the solution you'd like
Use `serde_json::to_writer` to serialize directly into the output writer.
For string-valued Variants, `to_json_string()` can return
`serde_json::to_string` directly instead of copying the result into another
buffer.
Preserve JSON escaping and I/O error behavior.
### Describe alternatives you've considered
_No response_
### Additional context
Related: #10906, #11101.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]