I am quite knew to TBB and would like to thank all for the great library.
I had a question and i apologise if for most of you this might be too easy.
At the moment i have quite sequential code for loading images from disk one by one and then do some comparisons from image to image.
I was thinking of using the parallel for parallelising this load and loading the data into a shared memory structure like a concurent hash table and do some of the operations which dont take much time.
At the moment i think the most time takes for the image loads.
Would that be the best approach or would you recomend somethign else?
Looking forward to your responsense.
TBB works best for compute-bound parallelisation, and does not deal well with tasks that spend a lot of their time waiting. You should look elsewhere for efficient ways to get data from the disk, and then when you have gathered some you can hand it over to TBB for processing. Perhaps it's as simple as issuing read() calls for the whole file at once, which might then deliver efficient big chunks, I'm not sure, but the multiplexing thread or multiple threads that does/do this should be kept separate from where data processing occurs.
You can try parallel_for, but - as the bottleneck here is in/out data transfer, not computations - I doubt any software parallelization can help here.
Comparing images can be paallelized, but loading from disk - only in a hardware way (whatever it would mean). Well, unless you have a few disks; then you could read from a few of them in parallel...