First time using Parallel

Era Scarecrow rtcvb32 at
Sun Dec 26 16:49:10 UTC 2021

On Sunday, 26 December 2021 at 15:36:54 UTC, Bastiaan Veelo wrote:
> On Sunday, 26 December 2021 at 15:20:09 UTC, Bastiaan Veelo 
> wrote:
>> So if you use `workerLocalStorage` ... you'll get your output 
>> in order without  sorting.
> Scratch that, I misunderstood the example. It doesn't solve 
> ordering. The example works because order does not matter for 
> addition. Sorry for spreading wrong information.

  Maybe. I did notice that the early stuff a bunch of output was 
getting mixed up;
         0x      0x      0x      0x      0x      0x      0x      
0x35    /*33,   /*,     /*,     /*115,  /*,     /*3,   /
*9,     /*3410*/*/

Which i assume it's doing several small write calls and different 
threads are acting at the same time. So if I do an appender 
string and then outputted the string as a single bock that would 
likely go away; Though it wouldn't help with ordering.

  **IF** I didn't have to wait so long to get results and wanted 
them all at once in order, I would write the results to the 
offsets of an array and then output it all at once at the end 
(*and since they'd have their own offset to write to you don't 
need to lock*).

More information about the Digitalmars-d-learn mailing list