Hello all,

I have been idly trying to make the SimpelITK libraries smaller. I noticed over 
35K of __PRETTY_FUNCTION__ string symbols in the simpleITK Python library, when 
build with the static sitk and itk libraries. The pretty function, is primarily 
used for the itkExceptoinMacros defined in itkMacro.h. I deleted that usage, 
and rebuilt. Now, there are only 5.7K of pretty symbols. The size of the 
library went down 11 megabytes, which is 9.5% of the total library size.

So our exceptions are entirely too verbose and there needs to be an option to 
reduce the amount of bloat they cause. As the macro already specifies the file 
name and line number where the exception occurred, I think the pretty location, 
is redundant, and quickly can cause bloat, so is should not be used in release 
mode by default.

I an reluctant to propose another top-level CMake variable for this, but  I 
think this option needs to go into the itkConfigure.h file, as having a command 
line define may be too problematic. 

Anyone have any thoughts on this topic?

I also would like to bring up that I am starting to use the 
"-fvisibility-inlines-hidden" and "-fvisibility=hidden". Initial results on 
SimpelITK reduced the library size by 20MB or 14%. The inline argument is 
harmless and appears to have no downside, and likely should be added as a 
default flag to just about all applications which use ITK. Changing the default 
visibility to hidden, is full of complications, and requires a large number of 
changes to the ITK libraries, mostly shouldn't be too hard.

I also believe that Wrap ITK should be able to significantly benefit from these 
observations, and likely reduce the size of the library by 20% with these 
improvements.

Brad

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
[email protected]



_______________________________________________
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

Reply via email to