spring/spring — comment on commit e93b2830d3b946a23b3a494e7e10786f76d223ea
File:  line 0
By jk3064:

It's not the place it's what you are doing.
1. You reduce the global thread pool and so making all other location where OMP is used __slower__.
2. Neither is it needed as said, the specific code block won't run faster by just reducing the pool size cause OMP wouldn't alloc more threads than needed.
3. There are other ways to limit the thread count that runs a code of block.

Also omp_set_num_threads() is meant for applications that have e.g. heavy (non-OMP) threads running which totally consume the time of full cores, so OMP can't make use of those.