[Insight-developers] Why is VariableLengthVector::GetSquaredNorm so slow?

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Sep 14 09:21:23 EDT 2011


Hello David,

It looks like you have factored the GetSize() method out side of the loop. This likely removes branching and exceptions from the loop making it suitable for SIMD/SEE vectorization.

Brad

On Sep 14, 2011, at 9:01 AM, David Doria wrote:

> I have noticed that if I loop over the elements of two
> VariableLengthVectors to compute the squared norm of their difference,
> it is about 3x faster than if I use the GetSquaredNorm() function. I
> have attached a demo which uses itkTimeProbe to show this. Can anyone
> explain the difference? My ManualDifference2 seems to me to be
> identical to GetSquaredNorm.
> 
> Thanks,
> 
> David
> <GetSquaredNormSpeedTest.cxx>_______________________________________________
> 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://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-developers

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110914/4ff9c5a8/attachment.htm>


More information about the Insight-developers mailing list