# Nested ParallelFor

**URL:** <https://forums.unrealengine.com/t/nested-parallelfor/452894>\
**Category:** C++\
**Tags:** multithreading, unreal-engine, question, CPP\
**Created:** [July 26, 2019, 10:46pm UTC](https://forums.unrealengine.com/t/nested-parallelfor/452894 "2019-07-26T22:46:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NuclearNadal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NuclearNadal](https://forums.unrealengine.com/u/NuclearNadal)\
**Post date:** [July 26, 2019, 10:46pm UTC](https://forums.unrealengine.com/t/nested-parallelfor/452894/1 "2019-07-26T22:46:47Z")

</div>

How do I parallelize the following code using ParallelFor:

`const TMap \< int32, TSet \< int32 \> \> map;

for(int i=0;i\< map.Num();++i)  
{  
for (int j=0;j\< map[i].Num();++j)  
{  
//do something  
}  
}`

using ParallelFor on the outer loop, makes sense, i am not sure about nested ParallelFor giving any performance gain
