The point still holds: if your single-threaded benchmark is not type-stable, you're absolutely, 100% wasting your time. Depending on your CPU, you might get perhaps a 4- to 8-fold improvement by using threads. But you might get a 30-fold speed improvement by making it type-stable. Which would you rather have?
Now, maybe this isn't an issue with your bigger problem, but the fact that you posted a toy problem with this issue makes me suspect that it's likely to be worth your time to first ensure that your single-threaded performance is as good as it can be. So start by using the profiler and @code_warntype, and extinguish any performance problems. If you still need more performance, then we can talk about threads. I've not played with them myself, so it's likely others will have to comment. Best, --Tim On Thursday, March 03, 2016 09:40:11 PM [email protected] wrote: > Thanks a lot for the suggestions. > As I have mentioned, it was really a toy problem, but I am not getting a > significant speedup on a bigger problem, where threads are nicely separated > either and the problem is very CPU bound either. I would be very interested > to know about tool that would point out to problems with cache and memory > access. > > Tomas
