The loop will benefit from parallelism when computations performed in parallel exceed the overhead when using parallelism (starting a thread, switching threads, communication, thread conflict, etc.). Your test seems to imply that parallelism should benefit trivial computing, but it is not. What he shows you is the overhead of parallelism. The amount of work should be more (and usually significantly higher) than the overhead so that you can see any benefit.
You also decline testing. Testing is the only way to find out if paralysis buys you. You do not need to check the performance of each cycle, only performance critical ones. If a cycle is not performance critical, why even bother its parallel? And if it’s critical enough to spend time drawing a parallel, you better take a test to make sure that you are benefiting from your labor and regression tests to ensure that some kind of smart programmer doesn’t destroy your work later.
source share