This S.O question is knocking on seven years old already.

It asks what the optimal number of threads is (or was, back in the days when there were no multi-core CPUS).

Is there any app which I can run against my program to benchmark, check & recommend the optimal number of threads (assuming, obviously, that all threads perform the same action)?

  • Wouldn't it suffice to use a general-purpose benchmarking library for your programming language? What would you want beyond that? Also, which language are you using? – Kodiologist Oct 5 '17 at 18:50
  • That sounds like I would have to make repeated builds, with increasing numbers of threads & benchmark them. I am wondering if there is a toll which does this; maybe a plugin for Valgrind – Mawg says reinstate Monica Oct 5 '17 at 19:24
  • Right. I think it can be done with a short shell loop like for nthreads in 1 2 3 4 5 6 7 8 9 10 ; do make THREADS=$nthreads && echo $nthreads && time ./myprogram ; done. – Kodiologist Oct 5 '17 at 19:37
  • Yes, I could knock up a Python script to do that. But I was wondering if there was an existing tool, maybe with more knowledge than I have, fancy GUI, charts, etc – Mawg says reinstate Monica Oct 5 '17 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.