I checked it a bit more carefully, the reason for the high memory usage is 
that I create a new instance of an anonymous function every time I call 
select!

I will try work around it.



On Monday, February 2, 2015 at 5:03:12 PM UTC+1, Kristoffer Carlsson wrote:
>
> I did some benchmarkling and I noticed that select! uses the majority of 
> memory(27 mb out of ~30) when I create a kd tree. I tried to remove the 
> return value from the select! function but it didn't make a big difference.
>
> The way I use select! is like this:
>
> select!(perm, mid_idx, by = i -> data[split_dim, i])
>
> Is it because I am using an anonymous function that I get heavy memory 
> usage?
>
>
>
>  
>
> On Sunday, February 1, 2015 at 11:53:02 AM UTC+1, [email protected] 
> wrote:
>>
>> I realize this is a more developer issue, but I'm wondering if anyone 
>> else thinks it would be a good idea for select! to be changed to not return 
>> A[r] (which allocates memory).
>>
>>
>> I think it could return (A[r.start], A[r.stop]), sub(A, r) or even 
>> nothing.  As it stands it seems like a performance penalty that can be 
>> avoided since the rest of the function should operate on memory in place. 
>>
>>
>> In my own project I've made a local copy of select for this reason and 
>> taken out the return value.
>>
>

Reply via email to