Context
Found during review of #45.
Problem
StreamingEncoder::encode_block() allocates a fresh Vec<u8> (encoded) for every emitted block. On the streaming hot path with large inputs, this adds avoidable allocation churn.
Suggested approach
Add an encoded_scratch: Vec<u8> field to StreamingEncoder, clear() it per block, and reuse the capacity across calls — similar to how FrameCompressor reuses its output buffer.
Files involved
zstd/src/encoding/streaming_encoder.rs (line 280)
Time estimate
1h
Context
Found during review of #45.
Problem
StreamingEncoder::encode_block()allocates a freshVec<u8>(encoded) for every emitted block. On the streaming hot path with large inputs, this adds avoidable allocation churn.Suggested approach
Add an
encoded_scratch: Vec<u8>field toStreamingEncoder,clear()it per block, and reuse the capacity across calls — similar to howFrameCompressorreuses its output buffer.Files involved
zstd/src/encoding/streaming_encoder.rs(line 280)Time estimate
1h