Boost logo

Boost Users :

From: Patrik Jonsson (patrik_at_[hidden])
Date: 2006-08-26 13:40:06


Janos Vegh wrote:
> Hi,
>
> I was interested in the efficiacy of std::vector.
> Using the test program below, I receive the following results.
> The "simple" handling is equivalent with the C array access.
> The [] and iterator access time of the vector element
> is an order of magnitude worse, than that of the simple access.
> This is not because of index limit control, it is done by at()
> and its use increases that access time by a factor of three.
> What is going on in the background here, that the implementation
> is so ineffective?
> ( I did my tests with WinXP/cygwin/g++/time,
> using different setting of the #define-s at the beginning)
> Shall I expect similar ineffectivity with the other STL objects?

What optimization options did you use? There should be little difference
in performance as long as the compiler inlines the vector access functions.

Regards,

/Patrik


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net