diff options
author | Sverker Eriksson <[email protected]> | 2015-11-13 18:12:32 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-11-27 19:28:37 +0100 |
commit | 4b4c3d525a06309b7e23c7c3ccf7a358bd0f33f3 (patch) | |
tree | 1ef9971987e1988b4e7f1f7d0771464745f8eb4d /erts/emulator/beam/hash.h | |
parent | 99e6213c0f0cebaa01f8310b6950a814cf4b21ee (diff) | |
download | otp-4b4c3d525a06309b7e23c7c3ccf7a358bd0f33f3.tar.gz otp-4b4c3d525a06309b7e23c7c3ccf7a358bd0f33f3.tar.bz2 otp-4b4c3d525a06309b7e23c7c3ccf7a358bd0f33f3.zip |
erts: Redesign grow/shrink thresholds of hash.c
1. Use load factor as indicator, not used buckets.
Used buckets is a bad indicator as it makes the situation even
worse with a bad hash function.
Set grow_threshold to load factor of 160% as it roughly corresponds
to the old 80% used bucket limit.
2. Never shrink table below initial size.
Diffstat (limited to 'erts/emulator/beam/hash.h')
-rw-r--r-- | erts/emulator/beam/hash.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/erts/emulator/beam/hash.h b/erts/emulator/beam/hash.h index c9e75d7acf..dc7e9c10c5 100644 --- a/erts/emulator/beam/hash.h +++ b/erts/emulator/beam/hash.h @@ -72,10 +72,11 @@ typedef struct hash ErtsAlcType_t type; char* name; /* Table name (static string, for debugging) */ int size; /* Number of slots */ - int size20percent; /* 20 percent of number of slots */ - int size80percent; /* 80 percent of number of slots */ - int ix; /* Size index in size table */ - int used; /* Number of slots used */ + int shrink_threshold; + int grow_threshold; + int size_ix; /* Size index in size table */ + int min_size_ix; /* Never shrink table smaller than this */ + int nobjs; /* Number of objects in table */ HashBucket** bucket; /* Vector of bucket pointers (objects) */ } Hash; |