[Insight-developers] CovariantVector::GetSquaredNorm()

David Doria daviddoria at gmail.com
Sun Sep 2 16:57:22 EDT 2012


On Sun, Sep 2, 2012 at 4:24 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
wrote:
>
> Hello David,
>
> Is the code you use to profile this available?
>
> Little bit of code like this can be very compiler and architecture
dependent. There is a lot of potential optimization. Even the way you
convert/round the result of the method to the integer your assigning it to
can make a big difference, you could look at the round methods in the
itk::Math namespace.
>
> Also what architecture and sse instruction sets are you compiling for?
x64 arch?
>
> Brad


Hi Brad,

Here is a demo (previously I had put this function actually in the
itkCovariantVector class, but this way seemed easier for a demo and I don't
think it changes anything):

https://github.com/daviddoria/ITKTimingDemos/blob/master/SquaredNorm/SquaredNorm.cpp

I am compiling with g++ 4.6.3. Using these flags:

-O3

and

-03 -msse2

seems to produce the same timings:

Built in time: 3.049

Custom time: 2.00261

Those are the only compiler flags I was passing - would it help to
explicitly specify an architecture? I am using a 32bit system.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120902/e5df61d5/attachment.htm>


More information about the Insight-developers mailing list