[Insight-developers] Empty FixedArray destructor: Performance hit using gcc (times 2)

Gert Wollny gert at die.upm.es
Thu Jun 5 11:04:57 EDT 2008


Am Donnerstag, den 05.06.2008, 10:24 -0400 schrieb Luis Ibanez:
> Hi Gert,
> 
> Thanks for the quick report !
> 
> It makes sense that -g flag will prevent the method
> from being optimized away.
> 
> If you have a chance,
> could you please test what happens when no -g is
> used, and the optimization flag is set to -O3 ?
It was not be optimized away, and valgrind/kcachegrind tells me  the
destructor is located in libITKCommon.so.

Actually, with -O3 the whole loop was optimized away. This is wired, to
say the least, because, if the compiler doesn't see the implementation
of the constructor and the destructor and uses the explicitly
instanciated one, it can not know whether there is done something
essential in one of the both, like changing a global variable.

I've added some code to force the loop (attached). 

BTW: I think -g doesn't change the optimizers at all (with g++). 

Best 

Gert 




-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_FixedArrayDestr.cc
Type: text/x-c++src
Size: 749 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20080605/99ff96c5/attachment.cc>


More information about the Insight-developers mailing list