actually use the power-of-two assumption, brings it on par with load factor of 0.5
This commit is contained in:
parent
b9c1928746
commit
e5810db4e2
|
@ -3019,7 +3019,7 @@ struct StringCache
|
||||||
&& is(Unqual!(ElementType!R) : const(ubyte)))
|
&& is(Unqual!(ElementType!R) : const(ubyte)))
|
||||||
{
|
{
|
||||||
uint h = hash(range);
|
uint h = hash(range);
|
||||||
uint bucket = h % index.length;
|
uint bucket = h & (index.length-1);
|
||||||
Slot *s = index[bucket];
|
Slot *s = index[bucket];
|
||||||
if(s == null)
|
if(s == null)
|
||||||
{
|
{
|
||||||
|
@ -3150,7 +3150,7 @@ private:
|
||||||
|
|
||||||
Slot*[] index;
|
Slot*[] index;
|
||||||
size_t uniqueSlots;
|
size_t uniqueSlots;
|
||||||
enum loadQuot = 1, loadDenom = 3;
|
enum loadQuot = 1, loadDenom = 2;
|
||||||
|
|
||||||
// leave some slack for alloctors/GC meta-data
|
// leave some slack for alloctors/GC meta-data
|
||||||
enum chunkSize = 16*1024 - size_t.sizeof*8;
|
enum chunkSize = 16*1024 - size_t.sizeof*8;
|
||||||
|
|
Loading…
Reference in New Issue