Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9674 in orxonox.OLD for trunk


Ignore:
Timestamp:
Aug 21, 2006, 6:57:29 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: here is the speedup test… more or less:
20 iterations of generating and deleting 10000 objects

old version:
real 0m7.485s
user 0m7.344s
sys 0m0.012s

new version:
real 0m0.627s
user 0m0.568s
sys 0m0.032s

for that it is way more dynamic, the speedup was worth it :)

Location:
trunk/src/lib/lang
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/lang/Makefile.am

    r9672 r9674  
    11MAINSRCDIR=../..
    22include $(MAINSRCDIR)/defs/include_paths.am
     3
     4LIB_PREFIX=$(MAINSRCDIR)/lib
     5include $(MAINSRCDIR)/lib/BuildLibs.am
    36
    47noinst_LIBRARIES = libORXlang.a
     
    1922
    2023
    21 bin_PROGRAMS = test_object_list
     24
     25## THIS ALL IS JUST FOR TESTING!!
     26check_PROGRAMS = test_object_list
    2227
    2328test_object_list_SOURCES = \
     
    2530
    2631test_object_list_LDADD = \
     32                $(MAINSRCDIR)/util/libORXutils.a \
     33                $(libORXlibs_a_LIBRARIES_) \
     34                $(MAINSRCDIR)/world_entities/libORXwe.a \
     35                $(libORXlibs_a_LIBRARIES_) \
     36                $(MAINSRCDIR)/util/libORXutils.a
     37
     38#test_object_list_LDADD = \
    2739                libORXlang.a
  • trunk/src/lib/lang/new_class_id.cc

    r9673 r9674  
    3737  ClassList::iterator it;
    3838  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     39  {
    3940    (*it)._objectList->unregisterObject((*it)._iterator);
     41    delete (*it)._iterator;
     42  }
    4043  //_objectList->unregisterObject(this->_iterators);
    4144}
  • trunk/src/lib/lang/new_object_list.h

    r9673 r9674  
    177177  for (it = this->_objects.begin(); it != this->_objects.end(); ++it)
    178178  {
    179     std::cout << (*it)->name() << std::endl;
     179    std::cout << (*it)->getName() << std::endl;
    180180  }
    181181}
  • trunk/src/lib/lang/test_object_list.cc

    r9673 r9674  
    33#include <iostream>
    44
    5 class BaseObject
     5#include <base_object.h>
     6
     7class NewBaseObject
    68{
    79public:
    810  void setName(const std::string& name) { this->_objectName = name; };
    9   const std::string& name() const { return _objectName; };
     11  const std::string& getName() const { return _objectName; };
    1012  bool operator==(const std::string& name) const { return _objectName == name; };
    1113
    12   NewObjectListDeclaration(BaseObject);
    13 
     14  NewObjectListDeclaration(NewBaseObject);
    1415
    1516protected:
    16   BaseObject(const std::string& objectName = "") : _objectName(objectName) { this->registerObject(this, objectList); };
     17  NewBaseObject(const std::string& objectName = "") : _objectName(objectName)
     18  {
     19    this->registerObject(this, objectList);
     20  };
    1721  template<class T>
    1822  inline void registerObject(T* object, NewObjectList<T>& objectList) { _id.registerObject(object, objectList); };
     
    2327
    2428};
    25 NewObjectListDefinition(BaseObject);
     29NewObjectListDefinition(NewBaseObject);
    2630
    2731
    28 class Test : public BaseObject
     32class Test : public NewBaseObject
    2933{
    3034public:
     
    4044Test::Test()
    4145{
     46//  this->setClassID(CL_PARENT_NODE, "Test");
    4247  this->registerObject(this, Test::objectList);
    43  // std::cout << "Test()\n";
     48  // std::cout << "Test()\n";
    4449};
    4550Test::~Test()
    4651{
    47 //  std::cout << "~Test()\n";
     52  //  std::cout << "~Test()\n";
    4853}
    4954
     
    5358  Bone()
    5459  {
    55     this->registerObject(this, Bone::objectList);
     60//    this->registerObject(this, Bone::objectList);
    5661    //std::cout << "Bone()\n";
    5762  };
    58   ~Bone() {
    59   //  std::cout << "~Bone()\n";
     63  ~Bone()
     64  {
     65    //  std::cout << "~Bone()\n";
    6066  };
    6167  NewObjectListDeclaration(Bone);
     
    6571int main()
    6672{
     73  for (unsigned int i = 0; i < 20; ++i)
     74  {
     75    std::cout<< i << std::endl;
     76    Test* test = new Test[10000];
     77    delete[]test;
     78  }
     79  //   char tmp[100];
     80  //   for (unsigned int i = 0 ; i < 100; ++i)
     81  //   {
     82  //     sprintf(tmp, "Tmp_%d", i);
     83  //     test[i].setName(tmp);
     84  //   }
     85  //   Test::objectList.debug();
     86  //   //test->setName("Test-object");
     87  //
     88  //   std::cout << "Here is debug of all BaseObject\n";
     89  //   BaseObject::objectList.debug();
     90  // //   delete bone;
     91  //   delete []test;
     92  //   std::cout << "Again\n";
     93  //   BaseObject::objectList.debug();
    6794
    68 
    69 
    70   Test* test = new Test[1000000];
    71   //test->setName("Test-object");
    72 
    73 //  Test::objectList.debug();
    74 /*
    75   Bone* bone = new Bone();
    76   bone->setName("Bone-object");*/
    77 
    78   //std::cout << "Here is debug of all Classes\n";
    79   //BaseObject::objectList.debug();
    80 //   delete bone;
    81   delete []test;
    8295}
    8396
Note: See TracChangeset for help on using the changeset viewer.