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/transaction.cc b/runtime/transaction.cc
index 0cfdfc5..b496f25 100644
--- a/runtime/transaction.cc
+++ b/runtime/transaction.cc
@@ -124,23 +124,23 @@
array_log.LogValue(index, value);
}
-void Transaction::RecordStrongStringInsertion(mirror::String* s, uint32_t hash_code) {
- InternStringLog log(s, hash_code, InternStringLog::kStrongString, InternStringLog::kInsert);
+void Transaction::RecordStrongStringInsertion(mirror::String* s) {
+ InternStringLog log(s, InternStringLog::kStrongString, InternStringLog::kInsert);
LogInternedString(log);
}
-void Transaction::RecordWeakStringInsertion(mirror::String* s, uint32_t hash_code) {
- InternStringLog log(s, hash_code, InternStringLog::kWeakString, InternStringLog::kInsert);
+void Transaction::RecordWeakStringInsertion(mirror::String* s) {
+ InternStringLog log(s, InternStringLog::kWeakString, InternStringLog::kInsert);
LogInternedString(log);
}
-void Transaction::RecordStrongStringRemoval(mirror::String* s, uint32_t hash_code) {
- InternStringLog log(s, hash_code, InternStringLog::kStrongString, InternStringLog::kRemove);
+void Transaction::RecordStrongStringRemoval(mirror::String* s) {
+ InternStringLog log(s, InternStringLog::kStrongString, InternStringLog::kRemove);
LogInternedString(log);
}
-void Transaction::RecordWeakStringRemoval(mirror::String* s, uint32_t hash_code) {
- InternStringLog log(s, hash_code, InternStringLog::kWeakString, InternStringLog::kRemove);
+void Transaction::RecordWeakStringRemoval(mirror::String* s) {
+ InternStringLog log(s, InternStringLog::kWeakString, InternStringLog::kRemove);
LogInternedString(log);
}
@@ -409,10 +409,10 @@
case InternStringLog::kInsert: {
switch (string_kind_) {
case InternStringLog::kStrongString:
- intern_table->RemoveStrongFromTransaction(str_, hash_code_);
+ intern_table->RemoveStrongFromTransaction(str_);
break;
case InternStringLog::kWeakString:
- intern_table->RemoveWeakFromTransaction(str_, hash_code_);
+ intern_table->RemoveWeakFromTransaction(str_);
break;
default:
LOG(FATAL) << "Unknown interned string kind";
@@ -423,10 +423,10 @@
case InternStringLog::kRemove: {
switch (string_kind_) {
case InternStringLog::kStrongString:
- intern_table->InsertStrongFromTransaction(str_, hash_code_);
+ intern_table->InsertStrongFromTransaction(str_);
break;
case InternStringLog::kWeakString:
- intern_table->InsertWeakFromTransaction(str_, hash_code_);
+ intern_table->InsertWeakFromTransaction(str_);
break;
default:
LOG(FATAL) << "Unknown interned string kind";