Add AccessSpreader<>::cachedCurrent()
Summary: `AccessSpreader::cachedCurrent()` caches the result of `AccessSpreader::getcpuFunc()` for 32 calls in a thread-local. The cached function takes 2 ns, where the current call takes 12 ns. This comes at the cost of being imprecise when threads migrate to a new cpu. I chose 32 as the number of calls because it only has a 10% overhead over never refreshing (2.05 ns vs 1.83 ns), where 16 has a 30% overhead, and it performs just as well as 64. Reviewed By: ot Differential Revision: D10151009 fbshipit-source-id: 07ed292dfdcdcedcb74c24279f7773a80ad09348
Showing
This diff is collapsed.
Please register or sign in to comment