Re:Spinning around: Please don't – Common problems with spin...
by Lectem on Thursday January 29, 2026 @12:30AM
(#46806178)
The issue with that is that a load fence may be very detrimental to perf. It doesn't really matter if rdtsc executes out of order in this code anyway, and there is no need for sync between cores.
[ Parent
| on HN ]
Re:Spinning around: Please don't – Common problems with spin...
by rdtsc on Thursday January 29, 2026 @11:26PM
(#46820513)
You could first measure the perf impact of the fence instruction and then subtract that out? But yeah I guess it may not matter much for quick and dirty calibration loop.
I found somewhere (https://aloiskraus.wordpress.com/2018/06/16/why-skylakex-cpu...) that the pause instruction had this wild cycle difference between different CPU and it caused some grief, I had no idea. I stopped doing low level coding a while back.