fvaleye opened a new pull request, #9214:
URL: https://github.com/apache/arrow-rs/pull/9214

   # Which issue does this PR close?
   N/A, it's a minor performance fix.
   
   # Rationale for this change
   While reviewing Parquet performance, I observed a duplicate `try_clone()`. I 
wasn't able to tell why it was required. After benchmarking and running tests, 
it seems there is no reason for the duplication.
   `ChunkReader::get_read()` for `File` calls 
[`try_clone()`](https://doc.rust-lang.org/std/fs/struct.File.html#method.try_clone)
 twice: once to seek, then again for the `BufReader`, discarding the first 
clone. This might be wasteful, as each `try_clone()` duplicates the file 
descriptor via a system call. So, one less dup() syscall per get_read() call.
   
   # What changes are included in this PR?
   Reuse the already-seeked file clone instead of creating a new one.
   
   # Are these changes tested?
   Covered by existing tests. 
   Local benchmarks using [divan](https://github.com/nvzqz/divan) show ~36% 
improvement for `get_read()` calls on my laptop.
   
   # Are there any user-facing changes?
    No.
   


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