Hi guys,

This one has me scratching my head. 

Matlab code:

function  Out  =myunique(A)
    sA=sort(A,2);
    [sA,rix]  = sortrows(sA);;
    d=sA(1:end-1,:)~=sA(2:end,:);
    ad=[true; any(d,2)];
    iu =find((ad&[ad(2:end);true])==true);
    Out =A(rix(iu),:);
end

was rewritten in Julia. Since some of the functionality is different (or 
slower) as written, I had to rewrite a bit.  The surprise was that even 
after the rewrite the Julia code runs in around 24 seconds whereas the 
Matlab code gets it done in two seconds.  As I went poking around to find 
what is slow, I found that 95% of the time were spent in the sort() and 
sortrrows() functions.

Any idea of what could cause this slowness? By the way, @code_warntype 
gives the code a clean bill... So are those two functions somehow slow by 
themselves?

The Julia version of this  is posted at 
https://gist.github.com/PetrKryslUCSD/cde67dfa0f1b0a1f98ac

Thanks,

Petr

Reply via email to