Was this issue ever resolved? I'm also interested in seeing a faster sortrows(), to the extent that this is possible.
For example, sorting 20 million random Float64s on my machine takes about 2-2.5 seconds, but a sortrows() on a 20 million by 2 matrix (again, random Float64 values) takes about 250 seconds. My algorithm theory is rusty here - is lexicographic sorting THAT much harder than simple sorting? Shouldn't it be nlogn? On Sunday, January 18, 2015 at 12:46:36 PM UTC-6, Viral Shah wrote: > > Certainly do file an issue with an easy to produce test case. I am pretty > sure we have not paid much attention to sortrows, and there is room for > improvement. > > -viral > > On Sunday, January 18, 2015 at 5:30:38 PM UTC+5:30, Tim Holy wrote: >> >> If you can reduce this to a standalone, runnable test case that uses only >> code >> from Base, it would be helpful to file an issue. >> >> --Tim >> >> On Saturday, January 17, 2015 05:36:36 PM Arch Call wrote: >> > Give alg=MergeSort a whirl. The doc says this is slower than >> alg=QuickSort >> > for numeric arrays, but who knows until you try. >> > >> > On Saturday, January 17, 2015 at 4:57:20 PM UTC-5, Petr Krysl wrote: >> > > 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 >> >>
