Boost logo

Boost-Commit :

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


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

Log:
added test_set_vector

Text files modified:
   sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp | 50 ++++++++++++++++++++++++++++++++++-----
   1 files changed, 43 insertions(+), 7 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:24:22 EDT (Fri, 19 Jun 2009)
@@ -112,6 +112,19 @@
         }
 };
 
+struct test_dupe_list_unaligned
+{
+ template <class Alloc>
+ int test(Alloc alloc, size_t count) const
+ {
+ typedef std::list<Unaligned, typename Rebind<Alloc, Unaligned>::type> List;
+ List list;
+ fill_n(back_inserter(list), count, 42);
+ List dupe = list;
+ return dupe.size();
+ }
+};
+
 struct test_dupe_vector
 {
         template <class Alloc>
@@ -129,6 +142,25 @@
         }
 };
 
+struct test_set_vector
+{
+ template <class Alloc>
+ int test(Alloc alloc, size_t count) const
+ {
+ typedef std::vector<int, typename Rebind<Alloc, int>::type> Vector;
+ typedef std::set<Vector, std::less<Vector>, typename Rebind<Alloc, Vector>::type> Set;
+ Set set;
+ for (size_t n = 0; n < count; ++n)
+ {
+ size_t size = count*rand()/RAND_MAX;
+ Vector vector(size);
+ generate_n(vector.begin(), size, rand);
+ set.insert(vector);
+ }
+ return 0;
+ }
+};
+
 struct PoolResult
 {
         double pool_elapsed;
@@ -234,6 +266,7 @@
                 result.std_elapsed = timer.elapsed();
         }
 
+ cout << ".";
         //cout << length << ": fast_pool, pool, std, mono, local: " << result.fast_pool_elapsed << ", " << result.pool_elapsed << ", " << result.std_elapsed << ", " << result.mono_elapsed << ", " << result.local_mono_elapsed << endl;
         return result;
 }
@@ -246,6 +279,7 @@
         {
                 results[length] = compare_memory_pool(count, length, fun);
         }
+ cout << endl;
         return results;
 }
 
@@ -262,19 +296,21 @@
 
 void compare_memory_pool()
 {
- cout << "test_dupe_list" << endl;
+ cout << "test_set_vector";
+ PrintResults(compare_memory_pool(50, 1000, 5, test_set_vector()));
+ cout << "test_dupe_list";
         PrintResults(compare_memory_pool(500, 2000, 10, test_dupe_list()));
- cout << "test_dupe_vector" << endl;
+ cout << "test_dupe_vector";
         PrintResults(compare_memory_pool(500, 2000, 10, test_dupe_vector()));
- cout << "thrash_pool" << endl;
+ cout << "thrash_pool";
         PrintResults(compare_memory_pool(50000, 2000, 10, thrash_pool()));
- cout << "thrash_pool_iter" << endl;
+ cout << "thrash_pool_iter";
         PrintResults(compare_memory_pool(50000, 2000, 10, thrash_pool_iter()));
- cout << "thrash_pool_sort" << endl;
+ cout << "thrash_pool_sort";
         PrintResults(compare_memory_pool(1000, 1000, 10, thrash_pool_sort()));
- cout << "thrash_pool_sort_list_int" << endl;
+ cout << "thrash_pool_sort_list_int";
         PrintResults(compare_memory_pool(1000, 2000, 10, thrash_pool_sort_list_int()));
- cout << "thrash_pool_map_list_unaligned" << endl;
+ cout << "thrash_pool_map_list_unaligned";
         PrintResults(compare_memory_pool(1000, 2000, 10, thrash_pool_map_list_unaligned()));
 }
 


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