diff options
author | Sverker Eriksson <[email protected]> | 2015-06-15 15:36:02 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-06-15 15:36:02 +0200 |
commit | 0476714af7f673de941225ed0daee1447935f248 (patch) | |
tree | af91592c0a3d4cc9933e034db26ed8232ce9827e /erts/emulator/beam/erl_map.h | |
parent | d9cf4788018c511e844320b437e8baf4ef7380ce (diff) | |
parent | f5138184479bd16c0ee0a5e583479378451401c8 (diff) | |
download | otp-0476714af7f673de941225ed0daee1447935f248.tar.gz otp-0476714af7f673de941225ed0daee1447935f248.tar.bz2 otp-0476714af7f673de941225ed0daee1447935f248.zip |
Merge branch 'hamt_bin2term'
* hamt_bin2term:
erts: Add erts_factory_trim_and_close
erts: Optimize driver_deliver_term
erts: Remove hashmap probabilistic heap overestimation
Conflicts:
erts/emulator/beam/beam_load.c
Diffstat (limited to 'erts/emulator/beam/erl_map.h')
-rw-r--r-- | erts/emulator/beam/erl_map.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_map.h b/erts/emulator/beam/erl_map.h index 2cc6768bfc..b5941c5c9a 100644 --- a/erts/emulator/beam/erl_map.h +++ b/erts/emulator/beam/erl_map.h @@ -91,7 +91,6 @@ Eterm erts_hashmap_insert_up(Eterm *hp, Eterm key, Eterm value, Uint *upsz, struct ErtsEStack_ *sp); int erts_validate_and_sort_flatmap(flatmap_t* map); -Uint hashmap_over_estimated_heap_size(Uint n); void hashmap_iterator_init(struct ErtsWStack_* s, Eterm node, int reverse); Eterm* hashmap_iterator_next(struct ErtsWStack_* s); Eterm* hashmap_iterator_prev(struct ErtsWStack_* s); @@ -191,5 +190,18 @@ typedef struct hashmap_head_s { #define hashmap_index(hash) (((Uint32)hash) & 0xf) +/* hashmap heap size: + [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 +*/ +#define HASHMAP_HEAP_SIZE(KEYS,NODES) ((KEYS)*3 + (NODES)*2) +#ifdef DEBUG +# define HASHMAP_ESTIMATED_NODE_COUNT(KEYS) (KEYS) +#else +# define HASHMAP_ESTIMATED_NODE_COUNT(KEYS) (2*(KEYS)/5) +#endif +#define HASHMAP_ESTIMATED_HEAP_SIZE(KEYS) \ + HASHMAP_HEAP_SIZE(KEYS,HASHMAP_ESTIMATED_NODE_COUNT(KEYS)) #endif |