6 ms·
How do you determine the number of shards to use?
by shepardrtc 2y ago
How do you determine the number of shards to use?
- willothy 2y agoI use a multiple of `std::thread::available_paralellism()`. Tbh I borrowed the strategy from dashmap, but I tested others and this seemed to work quite well. Considering making that configurable in the future so that it can be specialized for different use-cases or used in single-threaded but cooperatively scheduled contexts.
- cogman10 2y ago(std::thread::available_parallelism().map_or(1, usize::from) * 4).next_power_of_two()