From help-octave-request at bevo dot che dot wisc dot edu Tue Mar 9 04:08:11 2004 Subject: Re: octave benchmark test From: David Bateman To: "Dmitri A. Sergatskov" Cc: Paul Kienzle , Octave Help Date: Tue, 9 Mar 2004 11:00:49 +0100 Dmitri, Please find attached my test code for the speed of the sort code. This is based on a simialr benchmark within Python itself. Code is called like octave:1> sort_time = testsort('sort'); Test of the sorting function (sort) \ N |1.00e+02 1.00e+03 1.00e+04 1.00e+05 1.00e+06 Test \ | *sort |3.82e-05 5.26e-04 6.41e-03 8.65e-02 1.18e+00 \sort |1.15e-05 1.12e-04 1.13e-03 1.75e-02 2.08e-01 /sort |1.10e-05 1.07e-04 1.09e-03 1.49e-02 1.69e-01 3sort |2.06e-05 1.26e-04 1.19e-03 1.79e-02 2.22e-01 +sort |1.69e-05 1.19e-04 1.14e-03 1.66e-02 1.99e-01 =sort |1.09e-05 1.06e-04 1.11e-03 1.52e-02 1.67e-01 Normalized times against Matlab R12 on an IBM T23 \ N |1.00e+02 1.00e+03 1.00e+04 1.00e+05 1.00e+06 Test \ | *sort |2.25e+00 2.30e+00 2.35e+00 2.40e+00 2.31e+00 \sort |9.94e-01 8.17e-01 6.47e-01 7.78e-01 6.33e-01 /sort |1.03e+00 8.33e-01 6.59e-01 6.75e-01 5.49e-01 3sort |1.88e+00 9.63e-01 7.28e-01 8.20e-01 7.15e-01 +sort |1.12e+00 6.38e-01 5.17e-01 5.43e-01 4.27e-01 =sort |8.97e-01 6.76e-01 5.22e-01 5.64e-01 4.43e-01 octave:2> sort_time_index = testsort('sort, [], 1); Test of the sorting function (sort) with indexing \ N |1.00e+02 1.00e+03 1.00e+04 1.00e+05 1.00e+06 Test \ | *sort |6.39e-05 8.74e-04 1.15e-02 1.80e-01 2.55e+00 \sort |2.50e-05 2.54e-04 2.66e-03 3.95e-02 4.70e-01 /sort |2.46e-05 2.43e-04 2.51e-03 3.33e-02 4.03e-01 3sort |4.03e-05 2.73e-04 2.63e-03 3.66e-02 4.30e-01 +sort |3.34e-05 2.61e-04 2.56e-03 3.52e-02 4.20e-01 =sort |2.49e-05 2.49e-04 2.54e-03 3.40e-02 4.07e-01 Normalized times against Matlab R12 on an IBM T23 \ N |1.00e+02 1.00e+03 1.00e+04 1.00e+05 1.00e+06 Test \ | *sort |2.69e+00 2.89e+00 3.09e+00 3.12e+00 3.04e+00 \sort |1.54e+00 1.37e+00 1.19e+00 1.24e+00 1.14e+00 /sort |1.75e+00 1.50e+00 1.25e+00 1.18e+00 1.11e+00 3sort |2.67e+00 1.68e+00 1.31e+00 1.30e+00 1.19e+00 +sort |1.59e+00 1.08e+00 8.78e-01 8.42e-01 7.50e-01 =sort |1.28e+00 9.49e-01 6.93e-01 6.62e-01 6.07e-01 Note the times calibrated against Matlab R12 are only valid on my machine. D. According to Dmitri A. Sergatskov (on 03/09/04): > Paul Kienzle wrote: > > >It is reported to have better performance on partially ordered lists, > >but worse on random data compared to matlab. > > Well, may be I misunderstood what does "partially ordered means", but here > is > what I got. > (Matlab 6.5): > > >> x1=rand(3000); % random > >> x2=[1:3000]; % ordered > >> x3=repmat(x2,3000,1); % > >> x=x3+2*x1; % partially ordered ? > > > > >> tic ; sort(x1) ; toc > > elapsed_time = > > 1.4351 > > >> tic ; sort(x3) ; toc > > elapsed_time = > > 0.8567 > > >> tic ; sort(x) ; toc > > elapsed_time = > > 1.4285 > > >> x=x3+1.1*x1; > >> tic ; sort(x) ; toc > > elapsed_time = > > 1.4355 > > >> tic ; [y,idx]=sort(x) ; toc > > elapsed_time = > > 2.2073 > > >> tic ; [y,idx]=sort(x) ; toc % So we will not need to allocate y > and idx > > elapsed_time = > > 2.0607 > > > (Octave 2.1.56): > > octave:1> x1=rand(3000); > octave:2> x2=[1:3000]; > octave:3> x3=repmat(x2,3000,1); > octave:4> x=x3+2*x1; > octave:5> tic ; sort(x) ; toc > ans = 2.1968 > octave:6> tic ; sort(x1) ; toc > ans = 1.9328 > octave:7> tic ; sort(x3) ; toc > ans = 0.58155 > octave:8> tic ; [y,idx]= sort(x) ; toc > ans = 3.5003 > octave:9> tic ; [y,idx]= sort(x) ; toc > ans = 3.4638 > > > >Paul Kienzle > >pkienzle at users dot sf dot net > > > > Dmitri. > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------