Peter B. West
Fri, 22 Aug 2008 16:01:40 -0700
Jeremias Maerki wrote:
There's a lot of AND-ing of hash codes to determine the segments and buckets and that's much easier to handle if you have a power of 2 and can shift bits around. On 22.08.2008 16:22:05 Peter B. West wrote:Jeremias Maerki wrote:What happens is SEGMENT_COUNT is not a power of 2? Or, what obliges SEGMENT_COUNT to be a power of 2?Ok, here's the final patch I'd propose to fix the memory leak. I've seen no measurable performance degradation compared to the base revision and no multi-threading problems. The memory leak is fixed and the number of stale references remains low. Feedback welcome.Peter
That was my assumption when I saw 'MASK', in which case is it not safer to ensure that your value is in fact all ones?
MASK_BIT_COUNT = 5 SEGMENT_COUNT = 1<<MASK_BIT_COUNT or some such.