|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55085 - trunk/libs/spirit/benchmarks
From: joel_at_[hidden]
Date: 2009-07-22 13:07:13
Author: djowel
Date: 2009-07-22 13:07:13 EDT (Wed, 22 Jul 2009)
New Revision: 55085
URL: http://svn.boost.org/trac/boost/changeset/55085
Log:
Updates to boilerplate benchmark code
Text files modified:
trunk/libs/spirit/benchmarks/boiler_plate.cpp | 15 ++-------------
trunk/libs/spirit/benchmarks/measure.hpp | 8 ++------
2 files changed, 4 insertions(+), 19 deletions(-)
Modified: trunk/libs/spirit/benchmarks/boiler_plate.cpp
==============================================================================
--- trunk/libs/spirit/benchmarks/boiler_plate.cpp (original)
+++ trunk/libs/spirit/benchmarks/boiler_plate.cpp 2009-07-22 13:07:13 EDT (Wed, 22 Jul 2009)
@@ -4,38 +4,27 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
-
-// determine the type of the live_code. we can use this to test the
-// result of the code we are benchmarking
-#define BOOST_SPIRIT_TEST_LIVE_CODE_TYPE long long
#include "measure.hpp"
namespace
{
struct f
{
- typedef int type;
-
void benchmark(int x)
{
this->val += x; // Here is where you put code that you want
// to benchmark. Make sure it returns something.
// Anything.
}
-
- static int initial()
- {
- return 1; // our initial value
- }
- int val; // this is where the value is accumulated
+ int val; // This is needed to avoid dead-code elimination
};
}
int main()
{
BOOST_SPIRIT_TEST_BENCHMARK(
- 1000000, // This is the maximum repetitions to execute
+ 100000, // This is the maximum repetitions to execute
(f) // Place your tests here. For now, we have only one test: (f)
// If you have 3 tests a, b and c, this line will contain (a)(b)(c)
)
Modified: trunk/libs/spirit/benchmarks/measure.hpp
==============================================================================
--- trunk/libs/spirit/benchmarks/measure.hpp (original)
+++ trunk/libs/spirit/benchmarks/measure.hpp 2009-07-22 13:07:13 EDT (Wed, 22 Jul 2009)
@@ -12,10 +12,6 @@
# define _SECURE_SCL 0
#endif
-#if !defined(BOOST_SPIRIT_TEST_LIVE_CODE_TYPE)
-# define BOOST_SPIRIT_TEST_LIVE_CODE_TYPE int
-#endif
-
#include "high_resolution_timer.hpp"
#include <iostream>
#include <boost/preprocessor/seq/for_each.hpp>
@@ -27,7 +23,7 @@
// code elimination doesn't optimize away anything we're testing.
// We'll use it to compute the return code of the executable to make
// sure it's needed.
- BOOST_SPIRIT_TEST_LIVE_CODE_TYPE live_code;
+ int live_code;
// Call objects of the given Accumulator type repeatedly with x as
// an argument.
@@ -56,7 +52,7 @@
// this array. 1024 is an upper limit on the pipeline depth of
// current vector machines.
- typename Accumulator::type x = Accumulator::initial();
+ int x = 0;
const std::size_t number_of_accumulators = 1024;
live_code = 0; // reset to zero
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