Declaring variables inside a for loop using Threads.@threads has a significant impact on performance

This is the culprit. you overwrite nn which is an Int and later a float. changing the second nn to another name recovers the performance lost

3 Likes