On Friday, 1 March 2013 at 20:05:41 UTC, Sparsh Mittal wrote:
I am making a program which accesses 1D array using for loop
and then I am parallelizing this with foreach, TaskPool and
parallel.
The array does not need to change, once initialized. However,
the parallel version takes more time than serial version, which
I think may be because compiler is trying to make sure that
array is properly handled by different threads.
So, is there a way, an array can be made immutable and still
initialized? Thanks a lot for your time.
immutable arr = [ "some", "data", "that", "simple" ];
But I suppose your case is somewhat more complex. Probably you
can provide an example of problem via DPaste
(http://dpaste.1azy.net) ?