Re: Parallel array append using std.parallelism?

2020-06-19 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jun 19, 2020 at 06:48:18AM +, Simen Kjærås via Digitalmars-d-learn wrote: [...] > There's an example of exactly this in std.parallelism: > https://dlang.org/phobos/std_parallelism.html#.TaskPool.workerIndex > > In short: > > Item[] targetArray = ...; // already contains data >

Re: Parallel array append using std.parallelism?

2020-06-18 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 18 June 2020 at 14:43:54 UTC, H. S. Teoh wrote: I have an array of input data that I'm looping over, and, based on some condition, generate new items that are appended onto a target array (which may already contain data). Since the creation of new items is quite expensive, I'm thin

Parallel array append using std.parallelism?

2020-06-18 Thread H. S. Teoh via Digitalmars-d-learn
I have an array of input data that I'm looping over, and, based on some condition, generate new items that are appended onto a target array (which may already contain data). Since the creation of new items is quite expensive, I'm thinking to parallelize it with parallel foreach. To avoid data race