Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2823


Ignore:
Timestamp:
Mar 23, 2009, 11:12:14 AM (16 years ago)
Author:
rgrieder
Message:

Further optimisations by using std::vector instead of std::list for the sync lists.

Location:
code/branches/netp/src/network/synchronisable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp/src/network/synchronisable/Synchronisable.cc

    r2822 r2823  
    9898    // delete callback function objects
    9999    if(!Identifier::isCreatingHierarchy()){
    100       for(std::list<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
     100      for(std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
    101101        delete (*it);
    102102      if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
     
    252252
    253253    assert(this->classID==this->getIdentifier()->getNetworkID());
    254     std::list<SynchronisableVariableBase*>::iterator i;
     254    std::vector<SynchronisableVariableBase*>::iterator i;
    255255
    256256    // start copy header
     
    292292    if(mode==0x0)
    293293      mode=state_;
    294     std::list<SynchronisableVariableBase *>::iterator i;
     294    std::vector<SynchronisableVariableBase *>::iterator i;
    295295    if(syncList.empty()){
    296296      assert(0);
     
    337337    assert( mode==state_ );
    338338    tsize += this->dataSize_;
    339     std::list<SynchronisableVariableBase*>::iterator i;
     339    std::vector<SynchronisableVariableBase*>::iterator i;
    340340    for(i=stringList.begin(); i!=stringList.end(); ++i){
    341341      tsize += (*i)->getSize( mode );
  • code/branches/netp/src/network/synchronisable/Synchronisable.h

    r2822 r2823  
    3333
    3434#include <list>
     35#include <vector>
    3536#include <map>
    3637#include <queue>
     
    156157    uint32_t classID;
    157158
    158     std::list<SynchronisableVariableBase*> syncList;
    159     std::list<SynchronisableVariableBase*> stringList;
     159    std::vector<SynchronisableVariableBase*> syncList;
     160    std::vector<SynchronisableVariableBase*> stringList;
    160161    uint32_t dataSize_; //size of all variables except strings
    161162    static uint8_t state_; // detemines wheter we are server (default) or client
     
    196197
    197198//   template <class T> void Synchronisable::unregisterVariable(T& var){
    198 //     std::list<SynchronisableVariableBase*>::iterator it = syncList.begin();
     199//     std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin();
    199200//     while(it!=syncList.end()){
    200201//       if( ((*it)->getReference()) == &var ){
Note: See TracChangeset for help on using the changeset viewer.