EntityManager: Large speed improvement in Debug mode (~50x for projectile updates) by replacing std::vector<bool> with std::bitset.

This was SVN commit r4877.
This commit is contained in:
Ykkrosh 2007-02-09 22:07:15 +00:00
parent 5e3e78ca78
commit a734f9ccd7
2 changed files with 5 additions and 3 deletions

View File

@ -27,7 +27,6 @@ CEntityManager::CEntityManager()
m_nextalloc = 0;
m_extant = true;
m_death = false;
m_refd.resize( MAX_HANDLES );
// Also load a couple of global entity settings
CConfigValue* cfg = g_ConfigDB.GetValue( CFG_USER, "selection.outline.quality" );
@ -316,7 +315,9 @@ void CEntityManager::updateAll( size_t timestep )
void CEntityManager::interpolateAll( float relativeoffset )
{
for( int i = 0; i < MAX_HANDLES; i++ )
if( isEntityRefd(i) )
// This needs to handle all entities, including destroyed/non-extant ones
// (mainly dead bodies), so it can't use isEntityRefd
if( m_entities[i].m_refcount )
m_entities[i].m_entity->interpolate( relativeoffset );
}
@ -326,6 +327,7 @@ void CEntityManager::renderAll()
if( isEntityRefd(i) )
m_entities[i].m_entity->render();
}
void CEntityManager::conformAll()
{
PROFILE_START("conform all");

View File

@ -42,7 +42,7 @@ friend class CEntity;
friend class HEntity;
friend class CHandle;
CHandle m_entities[MAX_HANDLES];
std::vector<bool> m_refd;
std::bitset<MAX_HANDLES> m_refd;
std::vector<CEntity*> m_reaper;
std::vector<CEntity*>* m_collisionPatches;
int m_nextalloc;