foreach (i; taskPool.parallel(0..2_000_000)

Paul phshaffer at gmail.com
Tue Apr 4 21:35:29 UTC 2023


On Monday, 3 April 2023 at 23:50:48 UTC, Steven Schveighoffer 
wrote:
>
> So what you need is inside `createSpansOfNoBeacons`, take as a 
> reference a `ref Span[MAX_SPANS]`, and have it return a 
> `Span[]` that is a slice of that which was "alocated".
>
> See if this helps.

Well Steven just making the change you said reduced the execution 
time from ~6-7 secs to ~3 secs.  Then, including the 'parallel' 
in the foreach statement took it down to ~1 sec.

Boy lesson learned in appending-to and zeroing dynamic arrays in 
a hot loop!



More information about the Digitalmars-d-learn mailing list