From 9a048a8743c3d384b5e33d6383be97dc4858126e Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 20 Dec 2016 14:36:25 +0100 Subject: erts: Correct memory footprint for maps Small map was wrong as we should include our own top Eterm and exclude them for keys and values. Large maps was wrong as it described the theoretical minimum of a full tree, which does not happen in reality. --- system/doc/efficiency_guide/advanced.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/doc/efficiency_guide/advanced.xml b/system/doc/efficiency_guide/advanced.xml index eee2648f34..e1760d0ded 100644 --- a/system/doc/efficiency_guide/advanced.xml +++ b/system/doc/efficiency_guide/advanced.xml @@ -87,15 +87,15 @@ Small Map - 4 words + 2 words per entry (key and value) + the size of each key and value pair. + 5 words + the size of all keys and values. - Large Map + Large Map (> 32 keys) - At least, 2 words + 2 x N words + 2 x log16(N) words + - the size of each key and value pair, where N is the number of pairs in the Map. - A large Map is represented as a tree internally where each node in the tree is a - "sparse tuple" of arity 16. + N x F words + the size of all keys and values.

+ N is the number of keys in the Map.

+ F is a sparsity factor that can vary between 1.6 and 1.8 + due to the probabilistic nature of the internal HAMT data structure.
-- cgit v1.2.3