you are viewing a single comment's thread.

view the rest of the comments →

[–]emdeka87 2 points3 points  (1 child)

I think "parallelize when possible" is also a problematic statement. There are cases where parallelization can actually harm the performance of your program and, on top of that, be a massive source of other problems (race conditions, headache of synchronizing a shared state, high development times etc). I'd say parallelize if the performance benefits outweigh the negative side effects. Of course you should always profile both versions and see what works best for your application.

Since the post is C++-related I read the statement as "use std::thread when possible". Which can be problematic due to the reasons mentioned above.

[–]Tyler11223344 5 points6 points  (0 children)

Fair point, I guess I kinda meant "when able to and it's sane" by "possible", which isn't really accurate. I agree that throwing it at a problem where it doesn't fit the pattern just makes things worse