viirya commented on code in PR #2061:
URL: https://github.com/apache/arrow-rs/pull/2061#discussion_r921749773


##########
arrow/src/util/bit_chunk_iterator.rs:
##########
@@ -333,7 +333,7 @@ impl Iterator for BitChunkIterator<'_> {
             // the constructor ensures that bit_offset is in 0..8
             // that means we need to read at most one additional byte to fill 
in the high bits
             let next = unsafe {
-                std::ptr::read_unaligned(raw_data.add(index + 1) as *const u8) 
as u64
+                std::ptr::read_volatile(raw_data.add(index + 1) as *const u8) 
as u64

Review Comment:
   Hmm, I tried to code two mock versions of `next` function into 
`https://rust.godbolt.org/` (https://rust.godbolt.org/z/c4fEh45rb). The 
compiled results look the same. I assume it is accurate so the difference might 
be just fluctuating results. I'm going to close this and investigate if there 
is other place for optimizing `BitChunkIterator`.



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