Commits

Kelly Washington committed 5789076

MAINT-1897 Poor performance viewing large group member lists
* Use LLAvatarNameCache in group UI to match what namelists use and prevent double lookups
* Remove LLSD -> Prams legacy pattern which is super slow.
* Member list on general tab only adds to the list after names are known

  • Participants
  • Parent commits 5635117

Comments (0)

Files changed (5)

File indra/newview/llpanelgroup.h

 
 class LLOfferInfo;
 
-const S32 UPDATE_MEMBERS_PER_FRAME = 500;
+const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005; // 5ms
 
 // Forward declares
 class LLPanelGroupTab;

File indra/newview/llpanelgroupgeneral.cpp

 
 #include "llpanelgroupgeneral.h"
 
+#include "llavatarnamecache.h"
+#include "llagent.h"
+#include "llsdparam.h"
 #include "lluictrlfactory.h"
-#include "llagent.h"
 #include "roles_constants.h"
 
 // UI elements
 		{
 			mMemberProgress = gdatap->mMembers.begin();
 			mPendingMemberUpdate = TRUE;
+			mUdpateSessionID.generate();
 
 			sSDTime = 0.0f;
 			sElementTime = 0.0f;
 
 	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
 
-	if (!mListVisibleMembers || !gdatap 
+	if (!mListVisibleMembers 
+		|| !gdatap 
 		|| !gdatap->isMemberDataComplete()
 		|| gdatap->mMembers.empty())
 	{
 		return;
 	}
 
-	static LLTimer all_timer;
-	static LLTimer sd_timer;
-	static LLTimer element_timer;
+	LLTimer update_time;
+	update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
 
-	all_timer.reset();
+	LLAvatarName av_name;
+
 	S32 i = 0;
-
-	for( ; mMemberProgress != gdatap->mMembers.end() && i<UPDATE_MEMBERS_PER_FRAME; 
+	for( ; mMemberProgress != gdatap->mMembers.end() && !update_time.hasExpired(); 
 			++mMemberProgress, ++i)
 	{
-		lldebugs << "Adding " << mMemberProgress->first << ", " << mMemberProgress->second->getTitle() << llendl;
 		LLGroupMemberData* member = mMemberProgress->second;
 		if (!member)
 		{
 			continue;
 		}
-		// Owners show up in bold.
-		std::string style = "NORMAL";
-		sd_timer.reset();
-		LLSD row;
-		row["id"] = member->getID();
 
-		row["columns"][0]["column"] = "name";
-		row["columns"][0]["font"]["name"] = "SANSSERIF_SMALL";
-		row["columns"][0]["font"]["style"] = style;
-		// value is filled in by name list control
+		if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
+		{
+			addMember(mMemberProgress->second);
+		}
+		else
+		{
+			// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
+			LLAvatarNameCache::get(mMemberProgress->first, 
+									boost::bind(&LLPanelGroupGeneral::onNameCache,
+												this, mUdpateSessionID, member, _1, _2));
+		}
+	}
 
-		row["columns"][1]["column"] = "title";
-		row["columns"][1]["value"] = member->getTitle();
-		row["columns"][1]["font"]["name"] = "SANSSERIF_SMALL";
-		row["columns"][1]["font"]["style"] = style;
-
-		std::string status = member->getOnlineStatus();
-		
-		row["columns"][2]["column"] = "status";
-		row["columns"][2]["value"] = status;
-		row["columns"][2]["font"]["name"] = "SANSSERIF_SMALL";
-		row["columns"][2]["font"]["style"] = style;
-
-		sSDTime += sd_timer.getElapsedTimeF32();
-
-		element_timer.reset();
-		LLScrollListItem* member_row = mListVisibleMembers->addElement(row);
-		
-		if ( member->isOwner() )
-		{
-			LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(member_row->getColumn(0));
-			if (name_textp)
-				name_textp->setFontStyle(LLFontGL::BOLD);
-		}
-		sElementTime += element_timer.getElapsedTimeF32();
-	}
-	sAllTime += all_timer.getElapsedTimeF32();
-
-	lldebugs << "Updated " << i << " of " << UPDATE_MEMBERS_PER_FRAME << "members in the list." << llendl;
+	llinfos << "Updated " << i << " members in " << (F32)(1000.0 * update_time.getElapsedTimeF32()) << "ms this frame." << llendl;
 	if (mMemberProgress == gdatap->mMembers.end())
 	{
 		lldebugs << "   member list completed." << llendl;
 		mListVisibleMembers->setEnabled(TRUE);
-
-		lldebugs << "All Time: " << sAllTime << llendl;
-		lldebugs << "SD Time: " << sSDTime << llendl;
-		lldebugs << "Element Time: " << sElementTime << llendl;
 	}
 	else
 	{
 	}
 }
 
+void LLPanelGroupGeneral::addMember(LLGroupMemberData* member)
+{
+	LLNameListCtrl::NameItem item_params;
+	item_params.value = member->getID();
+
+	LLScrollListCell::Params column;
+	item_params.columns.add().column("name").font.name("SANSSERIF_SMALL");
+
+	item_params.columns.add().column("title").value(member->getTitle()).font.name("SANSSERIF_SMALL");
+
+	item_params.columns.add().column("status").value(member->getOnlineStatus()).font.name("SANSSERIF_SMALL");
+
+	LLScrollListItem* member_row = mListVisibleMembers->addNameItemRow(item_params);
+
+	if ( member->isOwner() )
+	{
+		LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(member_row->getColumn(0));
+		if (name_textp)
+			name_textp->setFontStyle(LLFontGL::BOLD);
+	}
+}
+
+void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLUUID& id, const LLAvatarName& av_name)
+{
+	if (!member 
+		|| update_id != mUdpateSessionID)
+	{
+		return;
+	}
+
+	addMember(member);
+}
+
 void LLPanelGroupGeneral::updateChanged()
 {
 	// List all the controls we want to check for changes...

File indra/newview/llpanelgroupgeneral.h

 class LLCheckBoxCtrl;
 class LLComboBox;
 class LLSpinCtrl;
+class LLAvatarName;
 
 class LLPanelGroupGeneral : public LLPanelGroupTab
 {
 
 	virtual void setupCtrls	(LLPanel* parent);
 
+	void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLUUID& id, const LLAvatarName& av_name);
 private:
 	void	reset();
 
 	static void onReceiveNotices(LLUICtrl* ctrl, void* data);
 	static void openProfile(void* data);
 
-	S32		sortMembersList(S32,const LLScrollListItem*,const LLScrollListItem*);
+	S32	 sortMembersList(S32,const LLScrollListItem*,const LLScrollListItem*);
+	void addMember(LLGroupMemberData* member);
 
     static bool joinDlgCB(const LLSD& notification, const LLSD& response);
 
 	BOOL			mChanged;
 	BOOL			mFirstUse;
 	std::string		mIncompleteMemberDataStr;
+	LLUUID			mUdpateSessionID;
 
 	// Group information (include any updates in updateChanged)
 	LLLineEditor		*mGroupNameEditor;

File indra/newview/llpanelgrouproles.cpp

 #include "llcheckboxctrl.h"
 
 #include "llagent.h"
+#include "llavatarnamecache.h"
 #include "llbutton.h"
 #include "llfiltereditor.h"
 #include "llfloatergroupinvite.h"
 	LLUIString donated = getString("donation_area");
 	donated.setArg("[AREA]", llformat("%d", data->getContribution()));
 
-	LLSD row;
-	row["id"] = id;
-
-	row["columns"][0]["column"] = "name";
-	// value is filled in by name list control
-
-	row["columns"][1]["column"] = "donated";
-	row["columns"][1]["value"] = donated.getString();
-
-	row["columns"][2]["column"] = "online";
-	row["columns"][2]["value"] = data->getOnlineStatus();
-	row["columns"][2]["font"] = "SANSSERIF_SMALL";
-
-	mMembersList->addElement(row);
+	LLNameListCtrl::NameItem item_params;
+	item_params.value = id;
+
+	item_params.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL");
+
+	item_params.columns.add().column("donated").value(donated.getString())
+			.font.name("SANSSERIF_SMALL").style("NORMAL");
+
+	item_params.columns.add().column("online").value(data->getOnlineStatus())
+			.font.name("SANSSERIF_SMALL").style("NORMAL");
+	mMembersList->addNameItemRow(item_params);
 
 	mHasMatch = TRUE;
 }
 
-void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, const LLUUID& id)
+void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLUUID& id, const LLAvatarName& av_name)
 {
 	// Update ID is used to determine whether member whose id is passed
 	// into onNameCache() was passed after current or previous user-initiated update.
 	// we do nothing.
 	if (mUdpateSessionID != update_id) return;
 	
-	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-		if (!gdatap) 
+	if (!member)
 	{
-		llwarns << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << llendl;
 		return;
 	}
 	
-	std::string fullname;
-	gCacheName->getFullName(id, fullname);
-
-	LLGroupMemberData* data;
 	// trying to avoid unnecessary hash lookups
-	if (matchesSearchFilter(fullname) && ((data = gdatap->mMembers[id]) != NULL))
+	if (matchesSearchFilter(av_name.getLegacyName()))
 	{
-		addMemberToList(id, data);
+		addMemberToList(id, member);
 		if(!mMembersList->getEnabled())
 		{
 			mMembersList->setEnabled(TRUE);
 
 
 	LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
-	
-	S32 i = 0;
-	for( ; mMemberProgress != end && i<UPDATE_MEMBERS_PER_FRAME; 
-			++mMemberProgress, ++i)
+
+	LLTimer update_time;
+	update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
+
+	for( ; mMemberProgress != end && !update_time.hasExpired(); ++mMemberProgress)
 	{
 		if (!mMemberProgress->second)
 			continue;
+
 		// Do filtering on name if it is already in the cache.
-		std::string fullname;
-		if (gCacheName->getFullName(mMemberProgress->first, fullname))
+		LLAvatarName av_name;
+		if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
 		{
-			if (matchesSearchFilter(fullname))
+			if (matchesSearchFilter(av_name.getLegacyName()))
 			{
 				addMemberToList(mMemberProgress->first, mMemberProgress->second);
 			}
 		else
 		{
 			// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
-			gCacheName->get(mMemberProgress->first, FALSE, boost::bind(&LLPanelGroupMembersSubTab::onNameCache,
-																	   this, mUdpateSessionID, _1));
+			LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache,
+																	   this, mUdpateSessionID, mMemberProgress->second, _1, _2));
 		}
 	}
 

File indra/newview/llpanelgrouproles.h

 	virtual void setGroupID(const LLUUID& id);
 
 	void addMemberToList(LLUUID id, LLGroupMemberData* data);
-	void onNameCache(const LLUUID& update_id, const LLUUID& id);
+	void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLUUID& id, const LLAvatarName& av_name);
 
 protected:
 	typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;