From 5f87267ebef5fca9e766a1080cc45b90e3e5fded Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Fri, 12 Mar 2021 15:30:05 -0500
Subject: [PATCH] Hashmapify some std::map<LLUUID in im code

---
 indra/newview/llfloaterimcontainer.h | 2 +-
 indra/newview/llimview.cpp           | 9 +++++----
 indra/newview/llimview.h             | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index a3510bfaf2e..db7be787e00 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -124,7 +124,7 @@ class LLFloaterIMContainer final
 
 
 private:
-	typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
+	typedef absl::flat_hash_map<LLUUID,LLFloater*> avatarID_panel_map_t;
 	avatarID_panel_map_t mSessions;
 	boost::signals2::connection mNewMessageConnection;
 
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 2758ddf13dc..db234367838 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -871,7 +871,7 @@ LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids)
 
 	if (mId2SessionMap.empty()) return NULL;
 
-	std::map<LLUUID, LLIMSession*>::const_iterator it = mId2SessionMap.begin();
+	auto it = mId2SessionMap.begin();
 	for (; it != mId2SessionMap.end(); ++it)
 	{
 		LLIMSession* session = (*it).second;
@@ -1097,9 +1097,10 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co
 
 bool LLIMModel::clearSession(const LLUUID& session_id)
 {
-	if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false;
-	delete (mId2SessionMap[session_id]);
-	mId2SessionMap.erase(session_id);
+	auto it = mId2SessionMap.find(session_id);
+	if (it == mId2SessionMap.end()) return false;
+	delete it->second;
+	mId2SessionMap.erase(it);
 	return true;
 }
 
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 279cf9d06a2..64ab0ec2b5f 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -174,7 +174,7 @@ class LLIMModel final :  public LLSingleton<LLIMModel>
 
 
 	/** Session id to session object */
-	std::map<LLUUID, LLIMSession*> mId2SessionMap;
+	absl::flat_hash_map<LLUUID, LLIMSession*> mId2SessionMap;
 
 	typedef boost::signals2::signal<void(const LLSD&)> session_signal_t;
 	session_signal_t mNewMsgSignal;
-- 
GitLab