diff options
author | Dave Parks <davep@lindenlab.com> | 2012-09-20 09:48:54 -0400 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2012-09-20 09:48:54 -0400 |
commit | f80d16808d21eaa9a3e8550284d25a43e2669ae2 (patch) | |
tree | 0a9f7330f5e56879ca7f623eb35a61590361157c /indra/newview | |
parent | 9bf49903edd5c67a2decdbe7bc0ca5b089763914 (diff) |
reapply 15b05dc53770: MAINT-646 Profile based optimization -- add a lookup map for joints to remove hotspot in LLJoint::findJoint
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 493e9cf392..dee19032f1 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -817,6 +817,7 @@ LLVOAvatar::~LLVOAvatar() lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; mRoot.removeAllChildren(); + mJointMap.clear(); deleteAndClearArray(mSkeleton); deleteAndClearArray(mCollisionVolumes); @@ -1934,6 +1935,7 @@ void LLVOAvatar::buildCharacter() // remove all of mRoot's children //------------------------------------------------------------------------- mRoot.removeAllChildren(); + mJointMap.clear(); mIsBuilt = FALSE; //------------------------------------------------------------------------- @@ -5137,7 +5139,20 @@ const LLUUID& LLVOAvatar::getID() const // RN: avatar joints are multi-rooted to include screen-based attachments LLJoint *LLVOAvatar::getJoint( const std::string &name ) { - LLJoint* jointp = mRoot.findJoint(name); + joint_map_t::iterator iter = mJointMap.find(name); + + LLJoint* jointp = NULL; + + if (iter == mJointMap.end()) + { //search for joint and cache found joint in lookup table + LLJoint* jointp = mRoot.findJoint(name); + mJointMap[name] = jointp; + } + else + { //return cached pointer + jointp = iter->second; + } + return jointp; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4081a1408d..f5692bb52f 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -366,6 +366,10 @@ public: LLVector3 mHeadOffset; // current head position LLViewerJoint mRoot; + + typedef std::map<std::string, LLJoint*> joint_map_t; + joint_map_t mJointMap; + protected: static BOOL parseSkeletonFile(const std::string& filename); void buildCharacter(); |