[Insight-developers] The Cost of Having something Pretty... 11 MB

Matthew McCormick (thewtex) matt at mmmccormick.com
Mon Mar 5 09:45:21 EST 2012


Hi Brad,

On Mon, Mar 5, 2012 at 9:23 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> 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 certainly agree.  It will help with SimpleITK and WrapITK library
sizes, and everything loads faster when the binaries are smaller.

>
> 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 would prefer not yet another CMake variable.  A more concise
exception could occur if defined( NDEBUG ) for example.

> 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.

We already have these as defaults for ITKCommon.  It would be great to have
them for the rest of the library.  However, I recall it was tricky for
ITKCommon.  "There be dragons."

Thanks,
Matt


>
> 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
>
> blowekamp at mail.nih.gov
>
>
>
>
>
> _______________________________________________
> 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
>


More information about the Insight-developers mailing list