summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-05-01 10:57:09 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-05-01 10:57:09 -0600
commit6244679b34bfb450bc83fd1ccd8c765028bb6735 (patch)
tree358d55acd23c849e3d48c1b9e72d22cce12d8b5c /indra/newview
parent41e5bf346eaa0a43646058691cc8090ddfe498e9 (diff)
performance optimization: only scan 32 objects per frame looking for invisibles.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvieweroctree.cpp2
-rw-r--r--indra/newview/llviewerregion.cpp31
2 files changed, 28 insertions, 5 deletions
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index 926d791d1f..2acacccbe6 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -524,7 +524,7 @@ void LLviewerOctreeGroup::handleChildAddition(const OctreeNode* parent, OctreeNo
}
else
{
- OCT_ERRS << "LLSpatialGroup redundancy detected." << llendl;
+ OCT_ERRS << "LLviewerOctreeGroup redundancy detected." << llendl;
}
unbound();
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index a2ff232d02..57fbaefce3 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1122,7 +1122,6 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time)
createVisibleObjects(max_update_time);
mImpl->mVisibleGroups.clear();
- mImpl->mWaitingList.clear();
sCurRegionp = NULL;
return did_update;
@@ -1135,16 +1134,40 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
{
return max_time;
}
+ if(mImpl->mActiveSet.empty())
+ {
+ return max_time;
+ }
+
+ static LLVOCacheEntry* last_visited_entry = NULL;
+ const size_t MAX_UPDATE = 32;
std::vector<LLDrawable*> delete_list;
- for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin();
- iter != mImpl->mActiveSet.end(); ++iter)
- {
+ S32 update_counter = llmin(MAX_UPDATE, mImpl->mActiveSet.size());
+ LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(last_visited_entry);
+
+ for(; update_counter > 0; --update_counter, ++iter)
+ {
+ if(iter == mImpl->mActiveSet.end())
+ {
+ iter = mImpl->mActiveSet.begin();
+ }
+
if(!(*iter)->isRecentlyVisible())
{
killObject((*iter), delete_list);
}
}
+
+ if(iter == mImpl->mActiveSet.end())
+ {
+ last_visited_entry = NULL;
+ }
+ else
+ {
+ last_visited_entry = *iter;
+ }
+
for(S32 i = 0; i < delete_list.size(); i++)
{
gObjectList.killObject(delete_list[i]->getVObj());