Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Rapid question about concurrent_vector.

isnork
Beginner
111 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
111 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
112 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
111 Views
Thank you Raf!
Reply