Dos and Donts [message #21923] |
Wed, 27 September 2000 00:00  |
Hans J�rg Brinksmey
Messages: 4 Registered: December 1998
|
Junior Member |
|
|
Hi there!
I'm preparing a little talk about efficient programming in IDL. From the
help files and from my own experience I found many hints about 'what to
do and not to do' to speed up code in IDL. The most things I listed so
far are about array operations and data arrangement, avoiding loops etc.
Taking an intensive look into the help system I found some little tricks
to improve speed, e.g. using rotation for image rotation by 90 deg
rather than rot(...,90). Up to now I didn't know that there is a
difference at all.
I am sure there are many more odds and ends to improve IDL code. Does
anyone out there can give my a hint where to find more of those tricks?
Links, recommendation of a book, or just some direct tips would be very
helpfull.
Thank you an advance and best greetings from Marburg,
Hans Joerg Brinksmeyer
--
H.J.Brinksmeyer - Physics Department
University of Marburg, Germany
|
|
|
Re: Dos and Donts [message #21963 is a reply to message #21923] |
Tue, 03 October 2000 00:00  |
pit
Messages: 92 Registered: January 1996
|
Member |
|
|
brinks <h.j.brinksmeyer@physik.uni-marburg.de> writes:
>> The argument a[0:63, 0:63] is passed to TEMPORARY by value, and
>> therefore cannot be modified. However the following method *does* save
>> memory:
>>
>> a = dist(256)
>> b = (temporary(a))[0:63, 0:63]
>> help, a, b
>> A UNDEFINED = <Undefined>
>> B FLOAT = Array[64, 64]
>
> Finally, that's something new, I didn't know before!!!
> Thank you very much :-)
But exactly as one should expect.
Concerning temporary:
Be carefull in tight memory situations.
If you *do* run out of memory in a
a = f(temporary(a))
statement, then a is lost as in the example above!
Peter
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Dr. Peter "Pit" Suetterlin http://www.astro.uu.nl/~suetter
Sterrenkundig Instituut Utrecht
Tel.: +31 (0)30 253 5225 P.Suetterlin@astro.uu.nl
____________________________________________________________ ______________
|
|
|