File 0632-Fix-performance-degradation-for-many-items-in-proces.patch of Package erlang
From c13cfc0711f5cbe2fc93c14be37810cbca8c2347 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 23 Sep 2020 10:28:49 +0200
Subject: [PATCH] Fix performance degradation for many items in process
dictionary
Modern versions of Clang emit a warning that the array size calculation
in erl_process_dict.c is wrong. Only half of the array would be used.
That would lead to a performance degradation if many items were stored in
the process dictionary.
---
erts/emulator/beam/erl_process_dict.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/erts/emulator/beam/erl_process_dict.c b/erts/emulator/beam/erl_process_dict.c
index 64ee483079..248da52db5 100644
--- a/erts/emulator/beam/erl_process_dict.c
+++ b/erts/emulator/beam/erl_process_dict.c
@@ -1052,7 +1052,7 @@ static unsigned int next_array_size(unsigned int need)
1342177280UL,
2684354560UL
};
- int hi = sizeof(tab) / sizeof(Uint) - 1;
+ int hi = sizeof(tab) / sizeof(tab[0]) - 1;
int lo = 1;
int cur = 4;
--
2.26.2