aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_map.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-12-08 15:02:43 +0100
committerSverker Eriksson <[email protected]>2015-12-08 15:02:43 +0100
commit7016d21eb3bec1bfb9381292be9f31cc25eadb03 (patch)
tree7249c8f737db4ee75f1a007e765d2c51bedb7637 /erts/emulator/beam/erl_map.h
parent4b17e3d6585bac8411d8f58d65d05e90156f5664 (diff)
parenta2b28094081f1b185a31b33e3c1bcb377d6761bb (diff)
downloadotp-7016d21eb3bec1bfb9381292be9f31cc25eadb03.tar.gz
otp-7016d21eb3bec1bfb9381292be9f31cc25eadb03.tar.bz2
otp-7016d21eb3bec1bfb9381292be9f31cc25eadb03.zip
Merge branch 'sverk/dist-ctrl-msg-overflow' into sverk/dist-ctrl-msg-overflow-master
Diffstat (limited to 'erts/emulator/beam/erl_map.h')
-rw-r--r--erts/emulator/beam/erl_map.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_map.h b/erts/emulator/beam/erl_map.h
index be6f791a4e..052fa99f03 100644
--- a/erts/emulator/beam/erl_map.h
+++ b/erts/emulator/beam/erl_map.h
@@ -180,14 +180,17 @@ typedef struct hashmap_head_s {
[one cons cell + one list term in parent node] per key
[one header + one boxed term in parent node] per inner node
[one header + one size word] for root node
+ Observed average number of nodes per key is about 0.35.
*/
-#define HASHMAP_HEAP_SIZE(KEYS,NODES) ((KEYS)*3 + (NODES)*2)
+#define HASHMAP_WORDS_PER_KEY 3
+#define HASHMAP_WORDS_PER_NODE 2
#ifdef DEBUG
-# define HASHMAP_ESTIMATED_NODE_COUNT(KEYS) (KEYS)
+# define HASHMAP_ESTIMATED_TOT_NODE_SIZE(KEYS) \
+ (HASHMAP_WORDS_PER_NODE * (KEYS) * 3/10) /* slightly under estimated */
#else
-# define HASHMAP_ESTIMATED_NODE_COUNT(KEYS) (2*(KEYS)/5)
+# define HASHMAP_ESTIMATED_TOT_NODE_SIZE(KEYS) \
+ (HASHMAP_WORDS_PER_NODE * (KEYS) * 4/10) /* slightly over estimated */
#endif
#define HASHMAP_ESTIMATED_HEAP_SIZE(KEYS) \
- HASHMAP_HEAP_SIZE(KEYS,HASHMAP_ESTIMATED_NODE_COUNT(KEYS))
-
+ ((KEYS)*HASHMAP_WORDS_PER_KEY + HASHMAP_ESTIMATED_TOT_NODE_SIZE(KEYS))
#endif