comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » looking for sort procedure
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
looking for sort procedure [message #7778] Wed, 15 January 1997 00:00 Go to next message
R. Bauer is currently offline  R. Bauer
Messages: 137
Registered: November 1996
Senior Member
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
Re: looking for sort procedure [message #7867 is a reply to message #7778] Tue, 21 January 1997 00:00 Go to previous messageGo to next message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
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
Re: looking for sort procedure [message #7869 is a reply to message #7778] Tue, 21 January 1997 00:00 Go to previous messageGo to next message
j.wendelstorf is currently offline  j.wendelstorf
Messages: 2
Registered: August 1996
Junior Member
> 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|
+----------------+---------------+---------------+---------- ------------+
Re: looking for sort procedure [message #7871 is a reply to message #7778] Tue, 21 January 1997 00:00 Go to previous messageGo to next message
llobet is currently offline  llobet
Messages: 10
Registered: May 1993
Junior Member
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
Re: looking for sort procedure [message #7890 is a reply to message #7778] Fri, 17 January 1997 00:00 Go to previous messageGo to next message
peter is currently offline  peter
Messages: 80
Registered: February 1994
Member
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
Re: looking for sort procedure [message #7894 is a reply to message #7778] Fri, 17 January 1997 00:00 Go to previous messageGo to next message
Jim O'connor is currently offline  Jim O'connor
Messages: 7
Registered: March 1996
Junior Member
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
Re: looking for sort procedure [message #7917 is a reply to message #7778] Sat, 25 January 1997 00:00 Go to previous messageGo to next message
R. Bauer is currently offline  R. Bauer
Messages: 137
Registered: November 1996
Senior Member
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
Re: looking for sort procedure [message #7957 is a reply to message #7778] Wed, 29 January 1997 00:00 Go to previous messageGo to next message
pford is currently offline  pford
Messages: 33
Registered: September 1996
Member
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
Re: looking for sort procedure [message #8096 is a reply to message #7778] Mon, 03 February 1997 00:00 Go to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
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
____________________________________________________________ ______________
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Speckle
Next Topic: KILL_NOTIFY Programs

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 14:28:48 PDT 2025

Total time taken to generate the page: 0.87632 seconds