Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54088 - sandbox/monotonic/libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-19 00:08:58


Author: cschladetsch
Date: 2009-06-19 00:08:56 EDT (Fri, 19 Jun 2009)
New Revision: 54088
URL: http://svn.boost.org/trac/boost/changeset/54088

Log:
added test_dupe_list/vector

Text files modified:
   sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp | 25 +++++++++++++++++++++----
   1 files changed, 21 insertions(+), 4 deletions(-)

Modified: sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp 2009-06-19 00:08:56 EDT (Fri, 19 Jun 2009)
@@ -104,12 +104,25 @@
         template <class Alloc>
         int test(Alloc alloc, size_t count) const
         {
- size_t dummy = 0;
- std::list<int, typename Rebind<Alloc, int>::type> list;
- fill_n(back_inserter(list), size, 42);
+ typedef std::list<int, typename Rebind<Alloc, int>::type> List;
+ List list;
+ fill_n(back_inserter(list), count, 42);
+ List dupe = list;
+ return dupe.size();
+ }
+};
+
+struct test_dupe_vector
+{
+ template <class Alloc>
+ int test(Alloc alloc, size_t count) const
+ {
+ typedef std::vector<int, typename Rebind<Alloc, Unaligned>::type> Vector;
+ Vector vector(count*rand()/RAND_MAX);
+ int dummy = 0;
                 for (size_t n = 0; n < count; ++n)
                 {
- List dupe = list;
+ Vector dupe = vector;
                         dummy += dupe.size();
                 }
                 return dummy;
@@ -249,6 +262,10 @@
 
 void compare_memory_pool()
 {
+ cout << "test_dupe_list" << endl;
+ PrintResults(compare_memory_pool(500, 2000, 10, test_dupe_list()));
+ cout << "test_dupe_vector" << endl;
+ PrintResults(compare_memory_pool(500, 2000, 10, test_dupe_vector()));
         cout << "thrash_pool" << endl;
         PrintResults(compare_memory_pool(50000, 2000, 10, thrash_pool()));
         cout << "thrash_pool_iter" << endl;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk