Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55065 - in trunk/libs/spirit: benchmarks/karma doc
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-21 10:44:04


Author: hkaiser
Date: 2009-07-21 10:44:03 EDT (Tue, 21 Jul 2009)
New Revision: 55065
URL: http://svn.boost.org/trac/boost/changeset/55065

Log:
Spirit: benchmark updates
Binary files modified:
   trunk/libs/spirit/doc/karma_performance.xlsx
Text files modified:
   trunk/libs/spirit/benchmarks/karma/double_performance.cpp | 18 +++++++++---------
   trunk/libs/spirit/benchmarks/karma/format_performance.cpp | 6 +++---
   trunk/libs/spirit/benchmarks/karma/int_generator.cpp | 8 ++++----
   trunk/libs/spirit/benchmarks/karma/sequence_performance.cpp | 18 +++++++++++++++++-
   4 files changed, 33 insertions(+), 17 deletions(-)

Modified: trunk/libs/spirit/benchmarks/karma/double_performance.cpp
==============================================================================
--- trunk/libs/spirit/benchmarks/karma/double_performance.cpp (original)
+++ trunk/libs/spirit/benchmarks/karma/double_performance.cpp 2009-07-21 10:44:03 EDT (Tue, 21 Jul 2009)
@@ -36,7 +36,7 @@
     }
     //]
 
- std::cout << "karma: " << t.elapsed() << std::endl;
+ std::cout << "karma:\t\t" << t.elapsed() << std::endl;
 // std::cout << buffer << std::endl;
 }
 
@@ -59,7 +59,7 @@
     }
     //]
 
- std::cout << "karma (rule): " << t.elapsed() << std::endl;
+ std::cout << "karma (rule):\t" << t.elapsed() << std::endl;
 // std::cout << buffer << std::endl;
 }
 
@@ -81,7 +81,7 @@
     }
     //]
 
- std::cout << "karma (direct): " << t.elapsed() << std::endl;
+ std::cout << "karma (direct):\t" << t.elapsed() << std::endl;
 // std::cout << buffer << std::endl;
 }
 
@@ -101,7 +101,7 @@
     }
     //]
 
- std::cout << "karma (string): " << t.elapsed() << std::endl;
+ std::cout << "karma (string):\t" << t.elapsed() << std::endl;
 // std::cout << generated << std::endl;
 }
 
@@ -118,11 +118,11 @@
         generated = boost::str(double_format % 12345.12345);
     //]
 
- std::cout << "format: " << t.elapsed() << std::endl;
+ std::cout << "format:\t\t" << t.elapsed() << std::endl;
 // std::cout << strm.str() << std::endl;
 }
 
-void format_performance_printf()
+void format_performance_sprintf()
 {
     util::high_resolution_timer t;
 
@@ -133,7 +133,7 @@
     }
     //]
 
- std::cout << "printf: " << t.elapsed() << std::endl;
+ std::cout << "sprintf:\t" << t.elapsed() << std::endl;
 // std::cout << buffer << std::endl;
 }
 
@@ -150,14 +150,14 @@
     }
     //]
 
- std::cout << "iostreams: " << t.elapsed() << std::endl;
+ std::cout << "iostreams:\t" << t.elapsed() << std::endl;
 // std::cout << strm.str() << std::endl;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 int main()
 {
- format_performance_printf();
+ format_performance_sprintf();
     format_performance_iostreams();
     format_performance_boost_format();
     format_performance_karma();

Modified: trunk/libs/spirit/benchmarks/karma/format_performance.cpp
==============================================================================
--- trunk/libs/spirit/benchmarks/karma/format_performance.cpp (original)
+++ trunk/libs/spirit/benchmarks/karma/format_performance.cpp 2009-07-21 10:44:03 EDT (Tue, 21 Jul 2009)
@@ -118,7 +118,7 @@
 // std::cout << strm.str() << std::endl;
 }
 
-void format_performance_printf()
+void format_performance_sprintf()
 {
     util::high_resolution_timer t;
 
@@ -129,7 +129,7 @@
     }
     //]
 
- std::cout << "printf:\t\t" << t.elapsed() << std::endl;
+ std::cout << "sprintf:\t" << t.elapsed() << std::endl;
 // std::cout << buffer << std::endl;
 }
 
@@ -161,7 +161,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 int main()
 {
- format_performance_printf();
+ format_performance_sprintf();
     format_performance_iostreams();
     format_performance_boost_format();
     format_performance_karma();

Modified: trunk/libs/spirit/benchmarks/karma/int_generator.cpp
==============================================================================
--- trunk/libs/spirit/benchmarks/karma/int_generator.cpp (original)
+++ trunk/libs/spirit/benchmarks/karma/int_generator.cpp 2009-07-21 10:44:03 EDT (Tue, 21 Jul 2009)
@@ -66,7 +66,7 @@
         }
         //]
 
- cout << "ltoa: " << t.elapsed() << " [s]" << flush << endl;
+ cout << "ltoa:\t\t" << t.elapsed() << " [s]" << flush << endl;
     }
 
     // test the iostreams library
@@ -83,7 +83,7 @@
         }
         //]
 
- cout << "iostreams: " << t.elapsed() << " [s]" << flush << endl;
+ cout << "iostreams:\t" << t.elapsed() << " [s]" << flush << endl;
     }
 
     // test the Boost.Format library
@@ -100,7 +100,7 @@
         }
         //]
 
- cout << "Boost.Format: " << t.elapsed() << " [s]" << flush << endl;
+ cout << "Boost.Format:\t" << t.elapsed() << " [s]" << flush << endl;
     }
 
     // test the Karma int_ generation routines
@@ -121,7 +121,7 @@
         }
         //]
 
- cout << "int_: " << t.elapsed() << " [s]" << flush << endl;
+ cout << "int_:\t\t" << t.elapsed() << " [s]" << flush << endl;
     }
 
     return 0;

Modified: trunk/libs/spirit/benchmarks/karma/sequence_performance.cpp
==============================================================================
--- trunk/libs/spirit/benchmarks/karma/sequence_performance.cpp (original)
+++ trunk/libs/spirit/benchmarks/karma/sequence_performance.cpp 2009-07-21 10:44:03 EDT (Tue, 21 Jul 2009)
@@ -16,6 +16,12 @@
 #include "../high_resolution_timer.hpp"
 
 ///////////////////////////////////////////////////////////////////////////////
+static char const* const literal_sequences[] = {
+ "", "a", "ab", "abc", "abcd", "abcde",
+ "abcdef", "abcdefg", "abcdefgh", "abcdefghi", "abcdefgij"
+};
+
+///////////////////////////////////////////////////////////////////////////////
 #define MAX_ITERATION 10000000
 #define MAX_SEQUENCE_LENGTH 9
 #define RCHAR(z, n, _) char_((char)('a' + n)) <<
@@ -27,11 +33,21 @@
         for (int i = 0; i < MAX_ITERATION; ++i) \
         { \
             char *ptr = buffer; \
+ generate(ptr, lit(literal_sequences[N]) << char_('\0')); \
+ } \
+ \
+ double elapsed = t.elapsed(); \
+ t.restart(); \
+ \
+ for (int i = 0; i < MAX_ITERATION; ++i) \
+ { \
+ char *ptr = buffer; \
             generate(ptr, BOOST_PP_REPEAT(N, RCHAR, _) char_('\0')); \
         } \
                                                                               \
         std::cout << "karma::sequence(" << BOOST_PP_INC(N) << "):\t" \
- << t.elapsed() << " [s]" \
+ << std::setw(8) << t.elapsed() << "\t" \
+ << std::setw(8) << elapsed << " [s]" \
             << std::flush << std::endl; \
     } \
     /**/

Modified: trunk/libs/spirit/doc/karma_performance.xlsx
==============================================================================
Binary files. No diff available.


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