Copy link to clipboard
Copied
Hi !
I'm facing two choices:
A. doing 4 to 75 iterations with the iterate suite, each one containing a for loop of around 10 000 loops
B. doing a for loop for the 4 to 75 loops, then inside that, iterating the 10 000 tiny things i need to do.
Which one is best? does it even matter? Is too much iterations are worse than a few?
Thanks for letting me know if you have a clue !
Gab
when dealing with multithreading, the best performance is not always the
most efficient algorithm mathematically, but the algorithm that can be best
split between cores.
if you can find a way to break the "huge" chunk into smaller tasks that can
be run in parallel, then you should get a big improvement in performance.
Copy link to clipboard
Copied
if i had to guess, it sounds like little iterations with a big loop inside
would have less overhead.
the trick would be to utilize the optimal amount of threads. too little and
you're not using all the machine's available power. to much and the threads
queuing would slow performance down.
in that respect, 4 threads sounds like too little threads for a workstation
to perform to it's full potential.
why not just test?
Copy link to clipboard
Copied
Thanks Shachar,
I'll do some performance test and post the results here.
also, the second loop is not always huge. it can vary between 10 and 10 000. so I guess at some point, all the threads can have finish their jobs and waiting for the last one to finish his huge task.
maybe there's a way to split all the tasks in an even amount of work.. let's see with some tests, as you say
Gab
Copy link to clipboard
Copied
when dealing with multithreading, the best performance is not always the
most efficient algorithm mathematically, but the algorithm that can be best
split between cores.
if you can find a way to break the "huge" chunk into smaller tasks that can
be run in parallel, then you should get a big improvement in performance.