aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/ops.tab
diff options
context:
space:
mode:
authorMichal Muskala <[email protected]>2017-07-01 17:19:52 +0200
committerMichal Muskala <[email protected]>2017-07-06 11:42:52 +0200
commit245aa4ed9b41aa601784598b0b3286d29b6d0085 (patch)
treede5448198979b0ccdc610883d4bcaafab326f0de /erts/emulator/beam/ops.tab
parente8a2cae09282b25a8eda9b6f04876e23a854336b (diff)
downloadotp-245aa4ed9b41aa601784598b0b3286d29b6d0085.tar.gz
otp-245aa4ed9b41aa601784598b0b3286d29b6d0085.tar.bz2
otp-245aa4ed9b41aa601784598b0b3286d29b6d0085.zip
Introduce new_small_map_lit op
Take advantage of the fact that small maps have a tuple for keys. When new map is constructed and all keys are literals, we can construct the entire keys tuple as a literal. This should reduce the memory of maps created with literal keys almost by half, since they all can share the same keys tuple.
Diffstat (limited to 'erts/emulator/beam/ops.tab')
-rw-r--r--erts/emulator/beam/ops.tab4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 4ce86ce949..ed856b760b 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -1425,7 +1425,11 @@ sorted_put_map_exact F Src=s Dst Live Size Rest=* => \
sorted_put_map_exact F Src Dst Live Size Rest=* => \
move Src x | update_map_exact F x Dst Live Size Rest
+new_map Dst Live Size Rest=* | is_small_map_literal_keys(Size, Rest) => \
+ gen_new_small_map_lit(Dst, Live, Size, Rest)
+
new_map d I I
+i_new_small_map_lit d I q
update_map_assoc j s d I I
update_map_exact j s d I I