Swap to absl hash maps on two extremely hot paths

This commit is contained in:
Rye Mutt
2019-10-07 12:07:00 -04:00
parent b4243dc95b
commit 77f8855fd6
4 changed files with 18 additions and 14 deletions

View File

@@ -2685,7 +2685,7 @@ void LLMeshRepository::notifyLoadedMeshes()
void LLMeshRepository::notifySkinInfoReceived(LLMeshSkinInfo& info)
{
mSkinMap[info.mMeshID] = info;
mSkinMap.insert_or_assign(info.mMeshID, info);
skin_load_map::iterator iter = mLoadingSkins.find(info.mMeshID);
if (iter != mLoadingSkins.end())
@@ -2792,8 +2792,8 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const
{
if (mesh_id.notNull())
{
skin_map::iterator iter = mSkinMap.find(mesh_id);
if (iter != mSkinMap.end())
const auto iter = mSkinMap.find(mesh_id);
if (iter != mSkinMap.cend())
{
return &(iter->second);
}

View File

@@ -39,6 +39,8 @@
#include "lluploadfloaterobservers.h"
#include "aistatemachinethread.h"
#include <absl/container/node_hash_map.h>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
@@ -561,7 +563,7 @@ public:
typedef std::map<LLVolumeParams, std::vector<LLVOVolume*> > mesh_load_map;
mesh_load_map mLoadingMeshes[4];
typedef boost::unordered_map<LLUUID, LLMeshSkinInfo> skin_map;
typedef absl::node_hash_map<LLUUID, LLMeshSkinInfo> skin_map;
skin_map mSkinMap;
typedef std::map<LLUUID, LLModel::Decomposition*> decomposition_map;

View File

@@ -2002,13 +2002,13 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi
return NULL;
}
mUUIDObjectMap[fullid] = objectp;
mUUIDObjectMap.insert_or_assign(fullid, objectp);
if(objectp->isAvatar())
{
LLVOAvatar *pAvatar = dynamic_cast<LLVOAvatar*>(objectp);
if(pAvatar)
{
mUUIDAvatarMap[fullid] = pAvatar;
mUUIDAvatarMap.insert_or_assign(fullid, pAvatar);
// <singu>
if (LLFloaterIMPanel* im = find_im_floater(fullid))
im->addDynamicFocus();
@@ -2052,13 +2052,13 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
regionp->addToCreatedList(local_id);
}
mUUIDObjectMap[fullid] = objectp;
mUUIDObjectMap.insert_or_assign(fullid, objectp);
if(objectp->isAvatar())
{
LLVOAvatar *pAvatar = dynamic_cast<LLVOAvatar*>(objectp);
if(pAvatar)
{
mUUIDAvatarMap[fullid] = pAvatar;
mUUIDAvatarMap.insert_or_assign(fullid, pAvatar);
// <singu>
if (LLFloaterIMPanel* im = find_im_floater(fullid))
im->addDynamicFocus();

View File

@@ -36,6 +36,8 @@
#include <map>
#include <set>
#include "absl/container/flat_hash_map.h"
// common includes
#include "llstat.h"
#include "llstring.h"
@@ -219,8 +221,8 @@ public:
uuid_set_t mDeadObjects;
boost::unordered_map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
boost::unordered_map<LLUUID, LLPointer<LLVOAvatar> > mUUIDAvatarMap;
absl::flat_hash_map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
absl::flat_hash_map<LLUUID, LLPointer<LLVOAvatar> > mUUIDAvatarMap;
//set of objects that need to update their cost
uuid_set_t mStaleObjectCost;
@@ -272,8 +274,8 @@ extern LLViewerObjectList gObjectList;
// Inlines
inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) const
{
boost::unordered_map<LLUUID, LLPointer<LLViewerObject> >::const_iterator iter = mUUIDObjectMap.find(id);
if(iter != mUUIDObjectMap.end())
auto iter = mUUIDObjectMap.find(id);
if(iter != mUUIDObjectMap.cend())
{
return iter->second;
}
@@ -285,8 +287,8 @@ inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) const
inline LLVOAvatar *LLViewerObjectList::findAvatar(const LLUUID &id) const
{
boost::unordered_map<LLUUID, LLPointer<LLVOAvatar> >::const_iterator iter = mUUIDAvatarMap.find(id);
return (iter != mUUIDAvatarMap.end()) ? iter->second.get() : NULL;
auto iter = mUUIDAvatarMap.find(id);
return (iter != mUUIDAvatarMap.cend()) ? iter->second.get() : NULL;
}
inline LLViewerObject *LLViewerObjectList::getObject(const S32 index)