Boost logo

Boost :

From: Anteru (newsgroups_at_[hidden])
Date: 2008-04-11 10:11:52


Mat Marcus schrieb:
> I'm surprised to hear you say this, as my experience is so different.
> To see whether this might be because things changed with in VC 9, I
> ran one of our benchmark suites to measure the _SECURE_SCL penalty for
> release builds. The benchmarks attempt, amongst other things, to
> measure the abstraction penalty by comparing the performance of
> different algorithms when using a vendor's vector with associated
> iterator type vs. an array with pointers.

Weird, tested the following snippet:
double* cdata = new double [100000];

for (int i = 0; i < 100000; ++i)
        cdata [i] = std::rand () / static_cast<float> (RAND_MAX);

std::vector<double> data (cdata, cdata + 100000);

Timer t;
std::sort (cdata, cdata + 100000);
std::cout << t.getElapsedTime () << std::endl;
t.reset ();
std::sort (data.begin (), data.end ());
std::cout << t.getElapsedTime () << std::endl;

delete [] cdata;

with Timer being a high-resolution timer on Windows. Results:

Debug/x64
0.0856235
2.25998

Release/x64
0.0164568
0.0163389 <-- The std::vector version is *faster*

For std::accumulate, its
Release/x64
0.000354514
0.000479391

in Release (ok, 50% slower but no way an order of magnitude) and
Debug/x64
0.000603987
0.0168896
in Debug.

Does not sound too bad to me actually? Not sure, maybe the x64 exception
handling is just vastly better for non-thrown exceptions. I'm keeping it
on, just in case, and I hope Boost won't override the compiler default.

Cheers,
   Anteru


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