Boost logo

Boost :

Subject: [boost] [accumulator][minmax_element] Perfomance comparsion different min max algorithm
From: Hansi (hansipet_at_[hidden])
Date: 2009-02-16 13:05:09


Hi,

I have made today a few tests to compare the different possibilities to
search min,max of a value. I had some really strange results which I
don't have expected. As environment I use VS2008 Express edition,not
managed, defines are SECURE_SCL=0 and NDEBUG=1.

In the comparsion I got the following timings:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
min_element,max_element:73
minVal=0,maxVal=9999999
min_max: accumulator:2338
minVal=0,maxVal=9999999
min_max: minmax_element:86
minVal=0,maxVal=9999999
min/max handcoded:135
minVal=0,maxVal=9999999
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

For me the strange things are:
- that std::min_element and std::max_element is faster as
boost::minmax_element
- the accumulator library seems in this example really slow

Best regards
Hansjörg

The source code was:

#include <algorithm>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics.hpp>
#include <boost/algorithm/minmax_element.hpp>
#include <boost/array.hpp>
#include <boost\chrono\chrono.hpp>

using namespace boost;
using namespace boost::chrono;
using namespace std;

typedef array<int,10000000> dataarray;

dataarray data;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk