First of all, kudos to your cache-aware indices. Though the underlying logic is not obvious (!), it does work and improves performances.
Two small things, not new to version 1.1:
-
The line:
char padding_[kCacheLineSize - sizeof(writeIdxCache_)]
has no effect as the global structure has a size that is already quantized, because of alignas(kCacheLineSize) members.
-
The way you compute kPadding is not optimal, because if sizeof(T) == kCacheLineSize, then kPadding is 1, while 0 would be better.
static constexpr size_t kPadding = (kCacheLineSize - 1) / sizeof(T) + 1;
First of all, kudos to your cache-aware indices. Though the underlying logic is not obvious (!), it does work and improves performances.
Two small things, not new to version 1.1:
The line:
char padding_[kCacheLineSize - sizeof(writeIdxCache_)]has no effect as the global structure has a size that is already quantized, because of
alignas(kCacheLineSize)members.The way you compute
kPaddingis not optimal, because if sizeof(T) == kCacheLineSize, thenkPaddingis 1, while 0 would be better.static constexpr size_t kPadding = (kCacheLineSize - 1) / sizeof(T) + 1;