mikeagn / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

HT_OCCUPANCY_FLT inconsistent #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Comments suggest that HT_OCCUPANCY_FLT is 0.8, but is later defined as 0.5.

Cheers,
Shaun

  // How full we let the table get before we resize.  Knuth says .8 is
  // good -- higher causes us to probe too much, though saves memory
  static const float HT_OCCUPANCY_FLT; // = 0.8;
...
// How full we let the table get before we resize.  Knuth says .8 is
// good -- higher causes us to probe too much, though saves memory
template <class V, class K, class HF, class ExK, class EqK, class A>
const float dense_hashtable<V,K,HF,ExK,EqK,A>::HT_OCCUPANCY_FLT = 0.5f;

Original issue reported on code.google.com by sjackman on 3 Mar 2009 at 9:57

GoogleCodeExporter commented 9 years ago
The definition is only inconsistent with the comments for densehashtable.h, 
where
HT_OCCUPANCY_FLT is 0.5. For sparsehashtable.h the definition and comments 
agree that
HT_OCCUPANCY_FLT is 0.8.

./sparsehash-1.4/src/google/sparsehash/densehashtable.h
const float dense_hashtable<V,K,HF,ExK,EqK,A>::HT_OCCUPANCY_FLT = 0.5f;

./sparsehash-1.4/src/google/sparsehash/sparsehashtable.h
const float sparse_hashtable<V,K,HF,ExK,EqK,A>::HT_OCCUPANCY_FLT = 0.8f;

Original comment by sjackman on 4 Mar 2009 at 12:25

GoogleCodeExporter commented 9 years ago
Looks like the code changed but the comment didn't.  I'll fix it for next 
release. 
0.5 is probably the right value for densehashtable.

Original comment by csilv...@gmail.com on 4 Mar 2009 at 8:37

GoogleCodeExporter commented 9 years ago
This should be fixed in sparsehash 1.5, just released.

Original comment by csilv...@gmail.com on 7 May 2009 at 3:10