IDL programming for Speed and Memory Management

The techniques demonstrated here all apply to MatLab as well as IDL, and most apply for any programming Language.

speedtest.pro - a set of demonstrations of how to write code that executes faster. The amount of system time taken for each demonstration is displayed. You can copy and save the text into a file with the '.pro' extension, then run it on your own computer. For each circumstance the slower running code is exhibited first, followed by an example of how to speed it up.

sub_memory.pro - examples of how to conserve memory while passing large variable arrays to subroutines. Normally a copy of each variable passed remains in main memory while a copy is made for the subroutine, doubling the memory usage (or even more if the subroutine passes the variable to another subroutine). There are two ways to avoid this copying of passed variables: