From 71d216b90256936a9638f325af9bc69d720e75de Mon Sep 17 00:00:00 2001
From: DongHun Kwak itest_class
classes, and
some other utilities:
-
//Iteration and element count defines const int NumIter = 100; const int NumElements = 50000; @@ -150,8 +149,6 @@ { return FuncObj::operator()(*a, *b); } };-
-
As we can see, test_class
is
a very simple class holding an int
.
@@ -184,8 +181,6 @@
Let's compare the code to be executed for each container type for different
insertion tests:
-
std::vector<typename ilist::value_type> objects(NumElements); ilist l; for(int i = 0; i < NumElements; ++i) @@ -193,26 +188,18 @@ //Elements are unlinked in ilist's destructor //Elements are destroyed in vector's destructor-
-
For intrusive containers, all the values are created in a vector and after that inserted in the intrusive list.
--
stdlist l; for(int i = 0; i < NumElements; ++i) l.push_back(typename stdlist::value_type(i)); //Elements unlinked and destroyed in stdlist's destructor-
-
For a standard list, elements are pushed back using push_back().
--
std::vector<typename stdlist::value_type> objects(NumElements); stdptrlist l; for(int i = 0; i < NumElements; ++i) @@ -220,14 +207,10 @@ //Pointers to elements unlinked and destroyed in stdptrlist's destructor //Elements destroyed in vector's destructor-
-
For a standard compact pointer list, elements are created in a vector and pushed back in the pointer list using push_back().
--
stdlist objects; stdptrlist l; for(int i = 0; i < NumElements; ++i){ objects.push_back(typename stdlist::value_type(i)); @@ -236,8 +219,6 @@ //Pointers to elements unlinked and destroyed in stdptrlist's destructor //Elements unlinked and destroyed in stdlist's destructor-
-
For a disperse pointer list, elements are created in a list and pushed back in the pointer list using push_back(). @@ -246,7 +227,7 @@ These are the times in microseconds for each case, and the normalized time:
Table 15.2. Back insertion + destruction times for Visual C++ 7.1 / Windows XP
+Table 15.2. Back insertion + destruction times for Visual C++ 7.1 / Windows XP
Table 15.3. Back insertion + destruction times for GCC 4.1.1 / MinGW over Windows +
Table 15.3. Back insertion + destruction times for GCC 4.1.1 / MinGW over Windows XP
Table 15.4. Back insertion + destruction times for GCC 4.1.2 / Linux Kernel 2.6.18 +
Table 15.4. Back insertion + destruction times for GCC 4.1.2 / Linux Kernel 2.6.18 (OpenSuse 10.2)