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

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Sep 14 13:02:47 EDT 2011


OK, you are right there. And there is no size checking for the operators either.

Another thought I have is that VariableLengthVector::operator- is returning a temporary vector, that may require a dynamic memory allocation. Where as you manual version does not...

Brad

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

> On Wed, Sep 14, 2011 at 9:21 AM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
>> 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
> 
> At line 365 in itkVariableLengthVector.hxx:
> 
> for ( unsigned int i = 0; i < this->m_NumElements; i++ )
> 
> it looks like the GetSize() call is not used at all since the size is
> stored as a member variable, right?
> 
> David

========================================================
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/cef37b17/attachment.htm>


More information about the Insight-developers mailing list