westonpace commented on pull request #9519:
URL: https://github.com/apache/arrow/pull/9519#issuecomment-783786543


   Some of the MSVC builds were complaining.  It appears that `alignas` with 
overaligned sizes was not properly supported in some of the older MSVC 
compilers.  Since the alignment is merely to ensure that the read and write 
indices are on separate cache lines and strict alignment isn't actually needed 
I changed the `alignas` statements to char padding instead.
   
   ```
   alignas(hardware_destructive_interference_size) AtomicIndex readIndex_;
   alignas(hardware_destructive_interference_size) AtomicIndex writeIndex_;
   ```
   vs
   ```
   AtomicIndex readIndex_;
   char pad1_[hardware_destructive_interference_size - sizeof(AtomicIndex)];
   AtomicIndex writeIndex_;
   ```
   
   I verified with benchmarks.
   `alignas` -> 16 million/second
   `nothing` -> 12 million/second
   `padding` -> 16 million/second
   
   However, this area is a little out of my depth, so if someone wants to 
confirm my reasoning I'd be grateful.


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to