Home » Community » Coffee corner » CoWork usage question
Re: CoWork usage question [message #51101 is a reply to message #51098] |
Thu, 24 January 2019 09:35 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi Mirek,
Well, that was interesting. I did some benchmarking and the looper is indeed a clear winner when there are a lot of small jobs to handle.
I further simplified the syntax for a "i = 0 .. n-1" -type of loop with a simple macro:
#define PARALLEL_LOOP(_ICOUNT_,_OPERATION_) { CoWork _co_; _co_ * [&] { for(int i = _co_.Next(); i < _ICOUNT_ ; i = _co_.Next()) { _OPERATION_; } };}
So, I can run the loop with:
PARALLEL_LOOP(n, operation(ib[i]));
Thanks and best regards,
Tom
|
|
|
Goto Forum:
Current Time: Tue Apr 23 19:14:17 CEST 2024
Total time taken to generate the page: 0.01934 seconds
|