JuliaParallel / DistributedArrays.jl

Distributed Arrays in Julia
Other
196 stars 35 forks source link

Unnecessary memory allocations in restrict_indices #215

Open raminammour opened 4 years ago

raminammour commented 4 years ago

Hello,

I found this when I was puzzled by a discourse question.

The function restrict_indices (called on line 824 in darray.jl, for example, couldn't figure out how to reference here), allocates an array of indices as big as the array that that you are trying to copy. Thus doubling the memory allocations.

Not sure if there is a way around it (just allocating tuples of ranges of indices or the like), but I thought I should file an issue so it doesn't get lost.

Cheers!

jishnub commented 4 years ago

Here is the line:

https://github.com/JuliaParallel/DistributedArrays.jl/blob/ffb128bd4623cf6108594585be0d95b35d5773a6/src/darray.jl#L824