Change intern table to unordered set.
Intern table active used bytes goes from 430k to 317k on system
server. Similar %wise savings on other apps.
Bug: 16238192
(cherry picked from commit d910fcef539e12ab181e56ec80684f39c4e95733)
Change-Id: Ic70395124435c6f420a77e6d8639404a160f395a
diff --git a/runtime/mirror/string-inl.h b/runtime/mirror/string-inl.h
index f98407b..14d7de2 100644
--- a/runtime/mirror/string-inl.h
+++ b/runtime/mirror/string-inl.h
@@ -23,6 +23,7 @@
#include "runtime.h"
#include "string.h"
#include "thread.h"
+#include "utf.h"
namespace art {
namespace mirror {
@@ -67,6 +68,16 @@
return GetCharArray()->Get(index + GetOffset());
}
+inline int32_t String::GetHashCode() {
+ int32_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(String, hash_code_));
+ if (UNLIKELY(result == 0)) {
+ result = ComputeHashCode();
+ }
+ DCHECK(result != 0 || ComputeUtf16Hash(GetCharArray(), GetOffset(), GetLength()) == 0)
+ << ToModifiedUtf8() << " " << result;
+ return result;
+}
+
} // namespace mirror
} // namespace art