[Insight-users] Guidelines for speed and memory footprint optimization
Matt McCormick
matt at mmmccormick.com
Wed Nov 10 10:27:38 EST 2010
Sergio Vera <sergio.vera at ...> writes:
>
>
> Also I may ask if you use streaming when there is no writer at the end? and if
yes, how you enable streaming in this case?
> Thanks
You can use the following filter
http://www.itk.org/Doxygen320/html/classitk_1_1StreamingImageFilter.html#_detail
s
>
> 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).
>
Interesting.
>
> 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.
>
Reading/writing to disk can be a bottleneck. Depending on the situation,
writing to a tmpfs can be helpful.
http://en.wikipedia.org/wiki/Tmpfs
>
>
> 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).
>
Profiling software not specific to ITK can be helpful for both decreasing run
times and memory footprints. My preference is valgrind.
http://valgrind.org/
For determining bootlenecks, try the valgrind callgrind tool + kcachegrind.
http://kcachegrind.sourceforge.net/
For memory profiling, try the valgrind massif tool + ms_print that comes with
valgrind.
>
> 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?
>
A wiki article would be cool.
Regards,
Matt
More information about the Insight-users
mailing list