Boost logo

Glas :

[glas] summary: auto-resizing vectors in assignment

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2005-02-04 07:44:33

The discussion on auto-resizing (or not) vectors in an assignment are
very intense so I tried to summarize the discussion on following page:

Please let me know if there are some points that I did not cover (we had
some discussions in circles and the same argument was given in different
forms and thus finally the total list of pro's for one or the other
approach are still limited). I will add additional arguments to this
page (so that you don't have to go through the archives the whole time).

Additionally, performance was mentioned a few times and David
(correctly) argumented that the effect on performance was not proven
yet. So I tried a to verify the performance-hit using a very simple test
which copies a large number of vectors. Once the test first verifies the
size before copying the vector, once it directly copies the vector
without verifying the sizes. And the test repeats this a few times.
Although the if test costs a few instructions, it is not certain that
this has an effect on the execution _time_ on intelligent processors
(like they all are now). However I think my test showed that there is
indeed a measureable (albeit small) difference. But actually such things
are exactly why I also invited compiler- and machine-vendors to this
list because they will certainly be able to clarify this issue (using
the knowledge on how their machine/cpu works internally and how the
compiler can optimise the scheduling). Vendors?