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
229 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
Valued Contributor III
229 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

0 Kudos
2 Replies
RafSchietekat
Valued Contributor III
230 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.
0 Kudos
isnork
Beginner
229 Views
Thank you Raf!
0 Kudos
Reply