Most times, first call of sortrows
function in MATLAB is significantly slower than other calls (if it doesn't meet the worst case of sorting I persume). Is it due to loading file with function to compiler? Can I load it earlier in order to make this first call faster?
sorting_times = []
for i=1:1:100
counter=1;
A=zeros(3);
for i=1:1:4
for j=i+1:1:5
A(licz,1)=i;
A(licz,2)=j;
A(licz,3)=randi([20,30]);
counter=counter+1;
end
end
tic;
sortrows(A,3);
sorting_times = [sorting_times toc];
end
plot(sorting_times);