File 1145-erts-Don-t-search-for-non-existing-Map-keys-twice.patch of Package erlang

From f86eabba45b351890ea8a12bd976c02b799c0e93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= <egil@erlang.org>
Date: Fri, 1 Apr 2016 16:16:46 +0200
Subject: [PATCH] erts: Don't search for non-existing Map keys twice

* For maps:get/2,3 and maps:find/2, searching for an immediate key, e.g. an atom,
  the search was performed twice if the key did not exist in the map.
---
 erts/emulator/beam/erl_map.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c
index 4b6931f..6b74725 100644
--- a/erts/emulator/beam/erl_map.c
+++ b/erts/emulator/beam/erl_map.c
@@ -200,13 +200,13 @@ erts_maps_get(Eterm key, Eterm map)
 		    return &vs[i];
 		}
 	    }
-	}
-
-	for (i = 0; i < n; i++) {
-	    if (eq_rel(ks[i], map_base, key, NULL)) {
-		return &vs[i];
-	    }
-	}
+	} else {
+            for (i = 0; i < n; i++) {
+                if (eq_rel(ks[i], map_base, key, NULL)) {
+                    return &vs[i];
+                }
+            }
+        }
 	return NULL;
     }
     ASSERT(is_hashmap_rel(map, map_base));
-- 
2.1.4

openSUSE Build Service is sponsored by