Rapid question about concurrent_vector.

Rapid question about concurrent_vector.


When declaring a concurrent_vector, i.e:

tbb::concurrent_vector v;

if the number of elementes that the vector will contain is known beforehand, using

v.reserve( size );

will improve the performance?

Thanks in advance.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Using reserve() generally seems to be a good idea. For tbb::concurrent_vector, it would appear to improve access time as well as growth time, but I have not analysed or measured this.

Thank you Raf!

Leave a Comment

Please sign in to add a comment. Not a member? Join today