Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54002 - sandbox/monotonic/libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-17 01:23:31


Author: cschladetsch
Date: 2009-06-17 01:23:30 EDT (Wed, 17 Jun 2009)
New Revision: 54002
URL: http://svn.boost.org/trac/boost/changeset/54002

Log:
cleaned up test_map_list
Text files modified:
   sandbox/monotonic/libs/monotonic/test/test_map_list.cpp | 58 ++++++++++++++++++++++-----------------
   1 files changed, 32 insertions(+), 26 deletions(-)

Modified: sandbox/monotonic/libs/monotonic/test/test_map_list.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/test_map_list.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/test_map_list.cpp 2009-06-17 01:23:30 EDT (Wed, 17 Jun 2009)
@@ -30,49 +30,55 @@
 
 Result test_map_list(size_t outter_loops, size_t inner_loops, monotonic::storage_base &storage)
 {
+ typedef std::map<int, std::list<int> > Map;
+ typedef std::map<int, std::list<int, monotonic::allocator<int> >, std::less<int>, monotonic::allocator<int> > MonoMap;
+
         Result result;
 
- // local monotonic allocator
- boost::timer t0;
- for (size_t n = 0; n < outter_loops; ++n)
+ // use standard allocator
         {
+ boost::timer timer;
+ for (size_t n = 0; n < outter_loops; ++n)
                 {
- typedef std::map<int, std::list<int, monotonic::allocator<int> >, std::less<int>, monotonic::allocator<int> > Map;
- Map map(std::less<int>(), storage);
- test_map_list_impl(inner_loops, map);
+ {
+ Map map;
+ test_map_list_impl(inner_loops, map);
+ }
                 }
- storage.reset();
+ result.standard = timer.elapsed();
         }
- double e0 = t0.elapsed();
 
- // standard allocator
- boost::timer t1;
- for (size_t n = 0; n < outter_loops; ++n)
+ // use static monotonic allocator
         {
+ boost::timer timer;
+ monotonic::static_storage.reset();
+ for (size_t n = 0; n < outter_loops; ++n)
                 {
- typedef std::map<int, std::list<int> > Map;
- Map map;
- test_map_list_impl(inner_loops, map);
+ {
+ MonoMap map;
+ test_map_list_impl(inner_loops, map);
+ }
+ monotonic::static_storage.reset();
                 }
+ result.static_monotonic = timer.elapsed();
         }
- double e1 = t1.elapsed();
 
- // static monotonic allocator
- boost::timer t2;
- monotonic::static_storage.reset();
- for (size_t n = 0; n < outter_loops; ++n)
+ // use monotonic allocator with supplied storage
         {
+ boost::timer timer;
+ for (size_t n = 0; n < outter_loops; ++n)
                 {
- typedef std::map<int, std::list<int, monotonic::allocator<int> >, std::less<int>, monotonic::allocator<int> > Map;
- Map map;
- test_map_list_impl(inner_loops, map);
+ {
+ MonoMap map(std::less<int>(), storage);
+ test_map_list_impl(inner_loops, map);
+ }
+ storage.reset();
                 }
- monotonic::static_storage.reset();
+ result.mono = timer.elapsed();
         }
- double e2 = t2.elapsed();
 
- cout << "test_map_list: " << inner_loops << ": " << e0 << ", " << e1 << ", " << e2 << endl;
- return Result(e0, e1, e2);
+ cout << "test_map_list: " << inner_loops << ": " << result.mono << ", " << result.standard << ", " << result.static_monotonic << endl;
+ return result;
 }
 
 void test_map_list_heap_stack()


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