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

Sergio Vera sergio.vera at alma3d.com
Wed Nov 10 11:19:36 EST 2010


Thanks for the tip!

Very interesting topic indeed... I believe it deserves a topic in the ITK
wiki.

On Wed, Nov 10, 2010 at 4:27 PM, Matt McCormick <matt at mmmccormick.com>wrote:

> 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
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>



-- 
Sergio Vera

 Alma IT Systems
 C/ Vilana, 4B, 4º 1ª
 08022 Barcelona
 T. (+34) 932 380 592
 www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101110/8fcdbef2/attachment.htm>


More information about the Insight-users mailing list