[Insight-users] Guidelines for speed and memory footprint optimization

Jerome Maudlin jerome.maudlin at gmail.com
Wed Nov 10 02:54:01 EST 2010


Dear all,

I am implementing a processing chain which has strong constraints in terms
of computational time and memory footprint. We are also forced to use one
single thread for whole pipeline.

I have identified several ways for optimizing my code, but I was wondering
if there are other things I could do. Here is what I have found until now:

1. For multi-channel images, the use of scalar images with FixedArray pixels
gives a 1.5 speedup factor with respect to the use of VectorImage with
scalar pixel types (I know the number of bands at compilation time).

2. Even though I need to work with real types for the computations (physical
magnitudes between 0 and 1), I found that writing intermediate results to
files using real types is much slower than multiplying the values by a large
constant and writing the result to disk using integer types.

I was also wondering if there is a smart way to choose the number of
streaming divisions for the writer in order to ensure that the memory
footprint of my program does not goes beyond a given size (other than try
and error).

Thank you very much for your help.

JM

PS: If there are general guidelines for this kind of optimization, maybe
there should be a chapter in the software guide or a wiki page for this
topic?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101110/7c477cbb/attachment.htm>


More information about the Insight-users mailing list