[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fastest operations/fctns.
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.html
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
--------------------------------------------------------------------------