Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

Rapid question about concurrent_vector.

isnork
Beginner
140 Views
Hi,

When declaring a concurrent_vector, i.e:
[bash]tbb::concurrent_vector v;[/bash]
if the number of elementes that the vector will contain is known beforehand, using
[bash]v.reserve( size );[/bash]
will improve the performance?

Thanks in advance.
0 Kudos
1 Solution
RafSchietekat
Black Belt
140 Views
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.

View solution in original post

2 Replies
RafSchietekat
Black Belt
141 Views
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.
isnork
Beginner
140 Views
Thank you Raf!
Reply