From 015bbc1c941912ffc43451304c50b6193cb2f4b2 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 11 Nov 2014 08:53:00 +0100 Subject: Scopes: make sure every bucket of the hash table is used Previously, one bucket was never used because in binary, 12*2^n - 1 = 101111... --- src/dotty/tools/dotc/core/Scopes.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/Scopes.scala') diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index 09bdca196..cd1eacc91 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -28,9 +28,11 @@ object Scopes { private final val FillFactor = 2.0/3.0 /** A hashtable is created once current size exceeds MinHash * FillFactor - * The initial hash table has twice that size (i.e 24). + * The initial hash table has twice that size (i.e 16). + * This value must be a power of two, so that the index of an element can + * be computed as element.hashCode & (hashTable.length - 1) */ - private final val MinHash = 12 + private final val MinHash = 8 /** The maximal permissible number of recursions when creating * a hashtable -- cgit v1.2.3