12#include "../Utils_Fill.h"
21 const unsigned N = 250000000;
22 cout <<
" Using vectors of size " << N <<
" \n";
24 std::vector<double> A( N, 0.0 );
32 cout <<
"\n Filling a std::vector via [].\n";
34 for ( std::size_t i = 0; i < N; ++i ) {
42 cout <<
"\n Filling a native array via [].\n";
44 for ( std::size_t i = 0; i < N; ++i ) {
48 double timeNative = timer.
get_time();
53 cout <<
"\n Filling a DenseVector via [].\n";
55 for ( std::size_t i = 0; i < N; ++i ) {
59 double timeDenseVec = timer.
get_time();
63 cout <<
"\nDenseVector slow down is " << 100*(timeDenseVec-timeNative)/timeNative <<
"\n";
64 cout <<
"STL:vector slow down is " << 100*(timeSTL-timeNative)/timeNative <<
"\n";
A spec for the CppNoddy Timer object.
A spec for a collection of utility functions.
An DenseVector class – a dense vector object.
A simple CPU-clock-tick timer for timing metods.
double get_time() const
Return the time.
void start()
Start the timer & reset stored time to zero.
void print() const
Write a string to cout stating the time taken.
void stop()
Stop the clock & add the current time interval to the previously stored values ready for printing.
void reset()
Pause the clock & add the time interval to the stored cumulative time.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...