Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hi, It was surprising me that's idl's build-in sort procedure is very very slow. for this example it needs on may RS6000 AIX more than 2 minutes. a = indgen(10000) b = [a,a] print,systime(0) s = b(sort(b)) print,systime(0) end This is much too long. Did someone have a better sort routine which I can have? -- R.Bauer Institut fuer Stratosphaerische Chemie (ICG-1) Forschungszentrum Juelich email: R.Bauer@kfa-juelich.de
Karl Krieger (kak@sat.ipp-garching.mpg.de) wrote: : "R. Bauer" <r.bauer@kfa-juelich.de> writes: : >It was surprising me that's idl's build-in sort procedure is very very : >slow. : Result for SUN: below 1 second, 6 seconds for a=lindgen(100000L) : Result for IBM: about 145 seconds Also slow on an HP (and, as Stein noted, blazingly fast for random vectors). Peter
R. Bauer wrote: > > It was surprising me that's idl's build-in sort procedure is very very > slow. > > for this example it needs on may RS6000 AIX more than 2 minutes. > ----- snip sort routine ------ > > This is much too long. Indeed. And it looks like it's not just IDL. PV-Wave 6.01 running on a HP9000 J200/99 using HP-UX 9.05a took 4.5 minutes to execute this code. -- Jim
llobet@elpp1.epfl.ch (Xavier Llobet i Sales EPFL-CRPP 1015 Lausanne CH) writes: > In article <5blhri$ks1@post.gsfc.nasa.gov>, thompson@orpheus.nascom.nasa.gov > (William Thompson) writes: ... > =I also tried the above example on a DEC AXP 3000/600 where it took about 60 > =seconds. I wonder if there's something in the code that is optimized for Sun > =workstations, maybe going back to the days when the first Unix port of IDL was > =called SunIDL? > = > =Bill Thompson > Here are the results on a DEC 3000 Model 400: > IDL. Version 3.6.1 (vms alpha). > [...] > IDL> a = indgen(10000) & b=[a,a] > IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) > Tue Jan 21 09:58:59 1997 > Tue Jan 21 09:59:00 1997 > IDL> > IDL> a=lindgen(100000L) & b=[a,a] > IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) > Tue Jan 21 10:00:18 1997 > Tue Jan 21 10:00:27 1997 > Which IDL version are you using? I suspect that it has more to do with the operating system than with the version of IDL. Here's the result on an AXP 3000/400 running VMS: IDL> a=lindgen(100000L) & b=[a,a] IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) Tue Jan 21 18:23:31 1997 Tue Jan 21 18:23:36 1997 whereas the same problem on a faster AXP 3000/600 running OSF seemed to take forever. (I eventually gave up.) I decreased the size of A by a factor of 10, which gave IDL> a=lindgen(10000L) & b=[a,a] IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) Tue Jan 21 23:35:39 1997 Tue Jan 21 23:36:48 1997 In both cases, I was using IDL v4.0.1, but I've also tried it with IDL v3.6.1 under OSF and got the same result. It's interesting that the same problem with the same version of IDL on essentially the same architecture gives completely different results for VMS and Unix. Bill Thompson
> R. Bauer wrote: >> >> It was surprising me that's idl's build-in sort procedure is very very >> slow. >> >> for this example it needs on may RS6000 AIX more than 2 minutes. >> > Indeed. And it looks like it's not just IDL. PV-Wave 6.01 running on a > HP9000 J200/99 using HP-UX 9.05a took 4.5 minutes to execute this code. I would estimate IDL uses the qsort-routine from the systems C-library. qsort in general sorts with O(n log(n)) [n=#of items], but degenerates to O(n^2) for unsorted or reverse sorted data. Maybe the "fast" systems have a workaround, the other did not. .. Just an idea, keeping "Sorting & Searching"-lessons in mind. Jens +----------------+---------------+---------------+---------- ------------+ |Jens Wendelstorf|Inst.of.Welding+TU-Braunschweig|j.wendelstorf@tu-bs.de| +----------------+---------------+---------------+---------- ------------+
In article <5blhri$ks1@post.gsfc.nasa.gov>, thompson@orpheus.nascom.nasa.gov (William Thompson) writes: =kak@sat.ipp-garching.mpg.de (Karl Krieger) writes: = =>"R. Bauer" <r.bauer@kfa-juelich.de> writes: [...] =>>for this example it needs on may RS6000 AIX more than 2 minutes. = =>>a = indgen(10000) =>>b = [a,a] =>>print,systime(0) =>>s = b(sort(b)) =>>print,systime(0) = =>>end = =>>This is much too long. = =>Hi all, = =>there seems to be a bug in the implementation of this routine: =>I tested it on a SUN Ultrasparc and on an IBM RS6000, which =>has about the same speed (at least for the Monte Carlo simulation =>coded in F77, which usually runs on these boxes). = =>Result for SUN: below 1 second, 6 seconds for a=lindgen(100000L) =>Result for IBM: about 145 seconds = =>Is this a known bug/feature? There seems to be a major problem =>either in the implementation of sort or in the way it uses =>the machine's resources (bad optimization?). = =I also tried the above example on a DEC AXP 3000/600 where it took about 60 =seconds. I wonder if there's something in the code that is optimized for Sun =workstations, maybe going back to the days when the first Unix port of IDL was =called SunIDL? = =Bill Thompson Here are the results on a DEC 3000 Model 400: IDL. Version 3.6.1 (vms alpha). [...] IDL> a = indgen(10000) & b=[a,a] IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) Tue Jan 21 09:58:59 1997 Tue Jan 21 09:59:00 1997 IDL> IDL> a=lindgen(100000L) & b=[a,a] IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) Tue Jan 21 10:00:18 1997 Tue Jan 21 10:00:27 1997 Which IDL version are you using? -xavier
I'd used idl 4.01 on AIX with the bad result. If I use idl 4.01 on win95 PC 100 MHz the routine needs only 1 second. a=lindgen(10000) After I shifted the array with a=shift(a,100) the aix machine needs only 2 seconds. But I did not understand why. R.Bauer
del >> =I also tried the above example on a DEC AXP 3000/600 where it took about 60 >> =seconds. I wonder if there's something in the code that is optimized for Sun >> =workstations, maybe going back to the days when the first Unix port of IDL was >> =called SunIDL? >> = >> =Bill Thompson > >> Here are the results on a DEC 3000 Model 400: > > >> IDL. Version 3.6.1 (vms alpha). >> [...] > >> IDL> a = indgen(10000) & b=[a,a] >> IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) >> Tue Jan 21 09:58:59 1997 >> Tue Jan 21 09:59:00 1997 >> IDL> >> IDL> a=lindgen(100000L) & b=[a,a] >> IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) >> Tue Jan 21 10:00:18 1997 >> Tue Jan 21 10:00:27 1997 > >> Which IDL version are you using? > > I suspect that it has more to do with the operating system than with the > version of IDL. Here's the result on an AXP 3000/400 running VMS: > > IDL> a=lindgen(100000L) & b=[a,a] > IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) > Tue Jan 21 18:23:31 1997 > Tue Jan 21 18:23:36 1997 > > whereas the same problem on a faster AXP 3000/600 running OSF seemed to take > forever. (I eventually gave up.) I decreased the size of A by a factor of 10, > which gave > > IDL> a=lindgen(10000L) & b=[a,a] > IDL> print,systime(0) & s = b(sort(b)) & print,systime(0) > Tue Jan 21 23:35:39 1997 > Tue Jan 21 23:36:48 1997 > > In both cases, I was using IDL v4.0.1, but I've also tried it with IDL v3.6.1 > under OSF and got the same result. > > It's interesting that the same problem with the same version of IDL on > essentially the same architecture gives completely different results for VMS > and Unix. > > Bill Thompson pro test a = indgen(100000L) b = [a,a] print,systime(0) s = b(sort(b)) print,systime(0) end IDL> test Wed Jan 29 22:25:25 1997 Wed Jan 29 22:25:28 1997 IDL 4.01 on a PPC 604 132 Mhz Mac clone for what it is worth. Patrick Ford Baylor College of Medicine
In article <pford-2901972229000001@news.compassnet.com>, pford@bcm.tmc.edu (Patrick Ford) writes: > IDL> test > Wed Jan 29 22:25:25 1997 > Wed Jan 29 22:25:28 1997 > IDL 4.01 on a PPC 604 132 Mhz Mac clone for what it is worth. Really? What System load did you have? Linux 4.01 on a Pentium 133 gives IDL> a = indgen(100000L) & b = [a,a] IDL> print,systime(0)&s = b(sort(b))&print,systime(0) Mon Feb 3 13:18:45 1997 Mon Feb 3 13:18:46 1997 IDL> a = lindgen(100000L) & b = [a,a] IDL> print,systime(0)&s = b(sort(b))&print,systime(0) Mon Feb 3 13:20:36 1997 Mon Feb 3 13:20:37 1997 Peter -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ Peter "Pit" Suetterlin http://www.uni-sw.gwdg.de/~pit Universitaets-Sternwarte Goettingen Tel.: +49 551 39-5048 pit@uni-sw.gwdg.de -- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- Come and see the stars! http://www.kis.uni-freiburg.de/~ps/SFB Sternfreunde Breisgau e.V. Tel.: +49 7641 3492 ____________________________________________________________ ______________