Re: efficient use of call_external [message #6282] |
Wed, 22 May 1996 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
nelson@star.net (Nelson Tarr) wrote:
>
> I am interested in any information on the speed improvement that can
> be expected in translating parts of an IDL procedure to C. I plan on
> using "call_external" to invoke the functions within my C module.
>
> I am also interested in suggestions about when it is most beneficial
> to use C instead of IDL.
If the operation you need can be performed using IDL's built-in
functions and/or array operations, you're better off sticking
with that. IDL functions are optimized very well.
If, in your code, you find yourself having to perform iterative
operations explicitly, then you are better off using C or Fortran,
as performance will improve DRAMATICALLY. Even though IDL code is
"compiled", the pseudo-code that is generated is interpreted,
so iterative operations take a big cut in performance.
Some of the examples of cases where we use CALL_EXTERNAL are:
1. Needed a "personalized" type of trilinear interpolation that
didn't use background (0) pixels in the interpolation (to
avoid aliasing an image with sharp edges).
2. A three-dimensional neighbor-averaging filter applied to a
3D data-set.
3. Needed a "personalized" run-length-encoding algorithm.
Hope this is useful.
Dave Foster
Brain Image Analysis Lab, UCSD
foster@bial1.ucsd.edu
|
|
|