Dandandan commented on code in PR #9400:
URL: https://github.com/apache/arrow-rs/pull/9400#discussion_r2801314093
##########
parquet/src/compression.rs:
##########
@@ -503,20 +503,27 @@ pub use lz4_codec::*;
#[cfg(any(feature = "zstd", test))]
mod zstd_codec {
- use std::io::{self, Write};
-
use crate::compression::{Codec, ZstdLevel};
use crate::errors::Result;
/// Codec for Zstandard compression algorithm.
+ ///
+ /// Uses `zstd::bulk` API with reusable compressor/decompressor contexts
+ /// to avoid the overhead of reinitializing contexts for each operation.
pub struct ZSTDCodec {
- level: ZstdLevel,
+ compressor: zstd::bulk::Compressor<'static>,
+ decompressor: zstd::bulk::Decompressor<'static>,
Review Comment:
Yeah just slapping a `thread_local!` would not be handy as we don't know
when it's good to clear it.
Perhaps an API could be changed/designed to reuse context/allocations like
this for multiple parquet reader instances on the same thread, though I don't
think the gain would be large.
--
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]