Re: fastest operations/fctns. [message #24780] |
Fri, 20 April 2001 17:46  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Johnny Lin <donotreply@interbulletin.bogus> writes:
> hi folks,
>
> i was wondering, has anyone compiled a ranked list of the relative
> speeds of IDL operations functions? i've read postings re general
> rules of thumb, but was wondering if anything more specific and
> complete is available online anywhere.
The fastest operation is the one that takes the least amount of time
:-)
Actually I'm being quite serious. If you really have a deep question
about the speed difference between two implementations, then go ahead
and try both and see which is fastest.
Things to bear in mind:
* vectorize where you can; if you can vectorize the inner loop, then
you are usually fine.
* there really are not *that* many different ways to do things; You
add with the "+" symbol, divide with the "/" symbol, etc.
* the RSI web page does have some good tips about speeding up your
code. Things like "group scalars into parentheses;" or "take
common expressions outside of FOR loops;" or "how to speed up array
indexing assignments"
* not all platforms are the same speed; some do certain operations
faster than others, even with the same IDL code.
Some techniques discussed here are not really about speed. For
example, I and others have mentioned "chunking," or dividing your huge
array up into smaller segments for processing. While this may save
time, what it really does is save *memory*. If you use too much
memory then your computer slows way down.
One legitimate question was over how to quickly expand an array (using
REBIN vs the "#" operator). You can find the newsgroup discussion --
with timings -- here:
http://cow.physics.wisc.edu/~craigm/idl/archive/msg00327.htm l
There are some other fancy tips like using NOZERO keyword for array
creation, but this is getting to be a fairly "niche" optimization.
Search around the archive and you can find other examples.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: fastest operations/fctns. [message #24872 is a reply to message #24780] |
Mon, 23 April 2001 13:53  |
Johnny Lin
Messages: 4 Registered: June 1999
|
Junior Member |
|
|
Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote in article
> [...]
>
> Things to bear in mind:
>
> [...]
>
> One legitimate question was over how to quickly expand an array (using
> REBIN vs the "#" operator). You can find the newsgroup discussion --
> with timings -- here:
>
thanks for the tips!...actually, the REBIN vs. "#" comment touches
upon something i'm curious on. i've noticed in the newsgroup that
oftentimes the soln. for a problem either involves:
- REBIN
- matrix multiplication, or
- HISTOGRAM
amongst these methods, which one is usually faster? i guess i'm asking
to try and figure out if i should finally make the time investment and
learn how to do those neat HISTOGRAM solns. JD Smith posts :)
thanks!
best,
-Johnny
-------------------------------------------
Johnny Lin
CIRES, University of Colorado
Work Phone: (303) 735-1636
Email: deja_jlin@my-deja.com
-------------------------------------------
_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com
|
|
|