gabotechs opened a new pull request, #12317: URL: https://github.com/apache/arrow-rs/pull/12317
Something that showed up during some profiling of a downstream project that depends on `arrow-rs`, hopefully the benchmarks in https://github.com/apache/arrow-rs/pull/12316 can be used for helping qualify this change (review that PR first) - Caches the `lz4_flex` `FrameDecoder` (block buffers) in `DecompressionContext` and reuses it across `decompress_lz4` calls instead of allocating a fresh decoder per buffer, mirroring the existing zstd context reuse. - Lends the input to the decoder as a `Buffer`, and releases it after each call so the decoder doesn't keep the IPC body alive. - On error, drops the cached decoder so the next call starts fresh. A frame missing its end mark leaves a reused decoder mid-frame, so errors from a reused decoder are retried once on a fresh one. ## Benchmark results Measured on a 16-core macOS machine, comparing the base of this stack (#12316, no decoder reuse) against this PR: `cargo bench -p arrow-ipc --bench ipc_reader --features lz4,zstd -- read_10/lz4` | Case | Criterion | |---|---| | `StreamReader/read_10/lz4` | +1.9% | | 256 rows, 1 thread | -2.7% | | 8,192 rows, 1 thread | -1.5% | | 256 rows, 16 threads | **-67.5%** | | 8,192 rows, 16 threads | -6.1% | -- 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]
