faster union?

Levente Torok toroklev at gmail.com
Sat Aug 9 10:25:00 CDT 2008


Hi all,

I also made a little experiment as such

l=10000000; 
r1=floor( 1000*rand( l, 1)); r2=floor( 1000 * rand( l, 1)); t=time; union( r1, r2 ) ; dt=time -t;
r1=floor( 1000*rand(l,1) ); r2=floor( 1000 * rand(l,1) ); t=time; z = sort( [r1,r2]); l=length(z); ind=[(z(1:l-1) - z(2:l))';1]; z( find(!ind) ) = []; dt2=time -t;

Speed increase is about:

dt / dt2 > 2

I guess it is not worth considering to improve.

Lev

-- 



More information about the Octave-maintainers mailing list