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

Home » Public Forums » archive » Re: Code optimization
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Code optimization [message #75200 is a reply to message #75116] Thu, 17 February 2011 12:52 Go to previous messageGo to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<ff8c9322-c3c0-4ed0-b9c2-73ae36c71a16@g10g2000vbv.googlegroups.com>,
kisCA <kis93@hotmail.com> wrote:

> Jeremy, I am amazed how you manage so quickly to find a way to
> optimize the code. Do you have some tips to achieve it?

Here is my short list of priorities for code optimization in IDL:

Optimize where it matters - Don't worry about optimizing code
that does not affect the overall cpu time.
Do binary I/O - NetCDF, HDF, or binary, not ASCII.
Access memory in order - Think about the order in which you are
likely to access your data before you define arrays. This will
make better use of caches in modern cpus.
Use IDL built-in functions and operators - There are many
tricks for using REBIN, REFORM, and HISTOGRAM, but be aware
that they are often memory intensive.
Optimize your innermost loop - Loops are not necessarily bad
in IDL if the calculations within a loop are well optimized.
Don't do unnecessary calculations (e.g., move constants out of loops)
Buy the IMSL library if you need those functions - Your time is
probably much more expensive than an IMSL license.

If you keep those things in mind, you will rarely have to resort
to the code profiler or external modules.

This seems sure to start a discussion. ;-)

Ken Bowman
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Resizeable Graphics Windows for Traditional Commands
Next Topic: make strsplit not skip null between patterns

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

Current Time: Fri Oct 10 19:25:45 PDT 2025

Total time taken to generate the page: 0.87977 seconds