felipecrv commented on PR #40647:
URL: https://github.com/apache/arrow/pull/40647#issuecomment-2007988096

   > Does it actually change anything for x86?
   
   Nothing, unless the compiler decides to re-order the loads and the stores. 
Which it didn't in this case.
   
   I suspect my change regarding `max_memory_` didn't lead to a cheaper 
sequence of instructions — I assumed `max_memory_.store(allocated, seq_cst)` 
(written as `max_memory_ = allocated;` in the code) was `lock`-prefixed and 
more expensive (combined with the `seq_cst` load) than the `compare_exchange` I 
added.
   
   
   > If you're really interested in reducing the contention costs for 
MemoryPool statistics, then I would suggest taking a look at 
https://travisdowns.github.io/blog/2020/07/06/concurrency-costs.html
   
   Not just the contention (the least of the issues really), but the time it 
takes to perform all the memory operations.


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