HuaHuaY commented on PR #48851:
URL: https://github.com/apache/arrow/pull/48851#issuecomment-3748838883

   In previous comments, because of the use of Arrow IPC, we found that the 
`Compress` and `Decompress` functions of `Codec` need to be thread-safe. There 
are two solutions:
   
   1. Use `thread_local` + `static`. However, I found that using `thread_local` 
introduces synchronization overhead, making context reuse slower than the 
original code.
   2. Selectively reuse the context by declaring a new class `ZstdCodecOptions` 
that inherits from `CodecOptions`, and using comments to indicate that it 
should only be enabled when `Codec` is not shared.
   
   I chose option 2.
   
   But after repeated testing, I found that in my private environment, reusing 
the context only resulted in a significant performance improvement when the 
compression level was greater than or equal to 6. There was no performance 
improvement, and even a performance decrease, when the compression level was 
less than 6 or during decompression. In the screenshot, a template parameter 
explicitly set to true indicates context reuse.
   
   <img width="2462" height="974" alt="image" 
src="https://github.com/user-attachments/assets/f2f84cf3-9490-4103-9e45-d336fd63d6f5";
 />
   
   Therefore, I've decided to close this PR. Those interested can still view 
the PR's commits.
   


-- 
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]

Reply via email to