Boost logo

Boost :

Subject: Re: [boost] [accumulator][minmax_element] Perfomance comparsion different min max algorithm
From: Dmitry Goncharov (dgoncharov_at_[hidden])
Date: 2009-02-17 05:01:26

Hansi wrote:
> 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
> ...

Why does this surprise you?
std::min() (or std::max) should be faster that boost::minmax().
boost::minmax() should be faster than subsequent invocation of
std::min() and then std::max().

BR, Dmitry

Boost list run by bdawes at, gregod at, cpdaniel at, john at