It is worthwhile to understand which TBB (Threading Building Blocks) are intended to be compared with other alternatives (e.g. C ++ 11x concurrency). TBB is a portable and scalable library (not a compiler extension) that allows you to write your code in the form of light tasks that TBB plans to schedule as quickly as possible on available CPU resources. It is not intended to support threads for other purposes (for example, for prevention).
I used TBB to speed up the processing of existing images for loops along the lines of scanning images into parallel loops (at least 2-4 scan lines in the form of βgrainβ). It was very successful. This requires that your loop body (re) be written to handle an arbitrary index, and not to assume that each loop object is processed sequentially (for example, pointers that increase between each iteration of the loop).
This was a pretty trivial case, as there was no general repository for updating. Using more powerful functions (such as a pipeline) will require significant redefinition and / or rewriting of existing code, so it may be better suited for new code.
This is a powerful advantage in that this TBB-based code remains portable, apparently does not interfere with another code in another place in the same process to use different thread strategies and can subsequently be combined with multiprocessor strategies at higher or lower level (for example, the TBB parallel_for code could be called from a filter in the multiprocessor TBB pipeline).
persiflage Dec 03 '17 at 11:36 on 2017-12-03 11:36
source share