|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53921 - sandbox/monotonic/libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-15 03:14:33
Author: cschladetsch
Date: 2009-06-15 03:14:32 EDT (Mon, 15 Jun 2009)
New Revision: 53921
URL: http://svn.boost.org/trac/boost/changeset/53921
Log:
added graph for bubble sort results
Text files modified:
sandbox/monotonic/libs/monotonic/test/main.cpp | 50 ++++++++++++++++++++++++++++++++++-----
sandbox/monotonic/libs/monotonic/test/monotonic.sln | 3 ++
2 files changed, 46 insertions(+), 7 deletions(-)
Modified: sandbox/monotonic/libs/monotonic/test/main.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/main.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/main.cpp 2009-06-15 03:14:32 EDT (Mon, 15 Jun 2009)
@@ -18,6 +18,7 @@
#include <boost/foreach.hpp>
#include <iostream>
#include <deque>
+#include <sstream>
#include <boost/range.hpp>
#include <boost/iterator/counting_iterator.hpp>
@@ -510,12 +511,9 @@
while (swapped);
}
-void test_bubble_sort()
+pair<double,double> test_bubble_sort(size_t count = 50*1000, size_t length = 20)
{
monotonic::inline_storage<100000> storage;
- const size_t count = 50000;
- const size_t length = 20;
-
boost::timer mono_timer;
for (size_t n = 0; n < count; ++n)
{
@@ -524,7 +522,7 @@
storage.reset();
}
double mono_total = mono_timer.elapsed();
- cout << "mono bubble sort: " << 1000*1000*mono_total/count << "us" << endl;
+ //cout << "mono bubble sort: " << 1000*1000*mono_total/count << "us" << endl;
boost::timer std_timer;
for (size_t n = 0; n < count; ++n)
@@ -533,12 +531,50 @@
test_bubble_sort_impl(length, list);
}
double std_total = std_timer.elapsed();
- cout << "std bubble sort: " << 1000*1000*std_total/count << "us" << endl;
+ //cout << "std bubble sort: " << 1000*1000*std_total/count << "us" << endl;
+ return make_pair(mono_total, std_total);
+}
+
+void graph_bubble_sort()
+{
+ const size_t count = 10000;
+ typedef std::map<size_t, pair<double, double> > Results;
+ Results results;
+ for (size_t length = 3; length < 50; length += 10)
+ {
+ results[length] = test_bubble_sort(count, length);
+ }
+ stringstream chart;
+ chart << "http://chart.apis.google.com/chart?chco=FF0000,00FF00&chs=250x100&cht=lc&chd=t:";
+ stringstream first;
+ stringstream second;
+ string comma = "";
+ double m = 0;
+ BOOST_FOREACH(Results::value_type const &result, results)
+ {
+ cout << result.first << '\t' << result.second.first << '\t' << result.second.second << endl;
+ first << comma << result.second.first;
+ second << comma << result.second.second;
+ comma = ",";
+ m = max(m, max(result.second.first, result.second.second));
+ }
+ chart << first.str() << "|" << second.str() << "&chds=0," << m << ",0," << m;
+ cout << chart.str() << endl;
}
+/*
+
+http://chart.apis.google.com/chart?chco=FF0000,00FF00&chs=250x100&cht=lc&chd=t:0.001,0.028,0.092,0.188,0.317|0.009,0.054,0.121,0.24,0.376&chds=0,0.376,0,0.376
+
+http://chart.apis.google.com/chart?chco=FF0000,00FF00&chs=250x100&cht=lc&chd=t:0.001,0.03,0.091,0.197,0.313,0.479,0.683,0.921,1.204,1.501|0.009,0.049,0.12,0.239,0.374,0.548,0.753,1.004,1.293,1.585&chds=0,1.585,0,1.585
+
+http://chart.apis.google.com/chart?chco=FF0000,00FF00&chs=250x100&cht=lc&chd=t:0.001,0.029,0.087,0.19,0.315,0.483,0.696,0.929,1.198,1.488,1.809,2.227,2.725,3.019,3.523,3.997,4.538,5.221,5.704,6.405|0.009,0.048,0.118,0.233,0.372,0.561,0.753,1.007,1.298,1.595,1.922,2.396,2.774,3.175,3.65,4.128,5.021,5.283,5.975,6.537&chds=0,6.537,0,6.537
+
+*/
int main()
{
- test_bubble_sort();
+ graph_bubble_sort();
+ //test_bubble_sort();
//test_map_list_realtime();
return 0;
//test_chain();
Modified: sandbox/monotonic/libs/monotonic/test/monotonic.sln
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.sln (original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.sln 2009-06-15 03:14:32 EDT (Mon, 15 Jun 2009)
@@ -17,4 +17,7 @@
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ VisualSVNWorkingCopyRoot = ..\..\..
+ EndGlobalSection
EndGlobal
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