Large object code

Hi,

We're statically linking our binaries to HDF5 (called via the C++ bindings) and it's somewhat disturbing how big the compiled code is (about ~1.9mb). Are there preprocessor defines that will reduce this significantly?

Thanks,
-Matt

Greetings Matt,

Matthew Chambers wrote:

We’re statically linking our binaries to HDF5 (called via the C++
bindings) and it’s somewhat disturbing how big the compiled code is
(about ~1.9mb).
Why do you find this disturbing? How big a file did you expect?

Are
there preprocessor defines that will reduce this significantly?

Hmmm, why would you expect this to work? I would expect just the
opposite–i.e. that defines will bloat the executable.

Cheers,

–dan

···
-- Daniel Kahn
Science Systems and Applications Inc.
301-867-2162

Sorry I wasn't clear. That's 1.9mb of just HDF5. The total .exe size went from 3.9 to 5.8mb.

Preprocessor defines could disable parts of the code that perhaps aren't necessary for general functionality.

-Matt

···

On 8/19/2011 9:39 AM, Daniel Kahn wrote:

Greetings Matt,

Matthew Chambers wrote:

We're statically linking our binaries to HDF5 (called via the C++ bindings) and it's somewhat
disturbing how big the compiled code is (about ~1.9mb).

Why do you find this disturbing? How big a file did you expect?

Are there preprocessor defines that will reduce this significantly?

Hmmm, why would you expect this to work? I would expect just the opposite--i.e. that /defines/ will
bloat the executable.

Cheers,
--dan

Matthew Chambers wrote:

Sorry I wasn't clear. That's 1.9mb of just HDF5. The total .exe size went from 3.9 to 5.8mb.

I'm still not sure why this is a problem since hard disks are commonly in the range 1 to 2 tb, but if it is any consolation our codes are all statically linked and the C codes come at about 5.9 to 6.0mb. The fortran code I use is 15mb.

Preprocessor defines could disable parts of the code that perhaps aren't necessary for general functionality.

Yes, I see your point. These defines would need to be switched on/off during the build of the library, presumably as options to configure. Parallel HDF5 comes to mind...

Cheers,
--dan

···

--
Daniel Kahn
Science Systems and Applications Inc.
301-867-2162

Hi Matt,

Sorry I wasn't clear. That's 1.9mb of just HDF5. The total .exe size went from 3.9 to 5.8mb.

Preprocessor defines could disable parts of the code that perhaps aren't necessary for general functionality.

  What platform are you building on? Are you using a debug or production build of HDF5?

  Quincey

···

On Aug 19, 2011, at 9:42 AM, Matthew Chambers wrote:

-Matt

On 8/19/2011 9:39 AM, Daniel Kahn wrote:

Greetings Matt,

Matthew Chambers wrote:

We're statically linking our binaries to HDF5 (called via the C++ bindings) and it's somewhat
disturbing how big the compiled code is (about ~1.9mb).

Why do you find this disturbing? How big a file did you expect?

Are there preprocessor defines that will reduce this significantly?

Hmmm, why would you expect this to work? I would expect just the opposite--i.e. that /defines/ will
bloat the executable.

Cheers,
--dan

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

The 1.9mb figure comes from a Windows 32-bit release build using MSVC 2008 SP1. My rsp file for building the H5 code looks like:

"H5.c" -Fo"H5.obj"
-TC /O2 /Ob2 /W0 /GR /MD /Zc:forScope /Zc:wchar_t /wd4996 -c
-D_SECURE_SCL=0
-DNDEBUG
-DWIN32
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-D_SECURE_SCL_THROWS=1
-D_SILENCE_DEPRECATION_OF_SECURE_SCL_THROWS
"-I."
"-Ihdf5-1.8.7\c++\src"
"-Ihdf5-1.8.7\src"
"-Ihdf5-1.8.7\src\windows"

I'm using a hacked up Boost.Build Jamfile to do the build using the following H5pubconf.h:
http://codepad.org/wOB3CrAo

I don't remember the exact flags I used with CMake to generate it, but it was pretty basic.

-Matt

···

On 8/25/2011 9:39 AM, Quincey Koziol wrote:

Hi Matt,

On Aug 19, 2011, at 9:42 AM, Matthew Chambers wrote:

Sorry I wasn't clear. That's 1.9mb of just HDF5. The total .exe size went from 3.9 to 5.8mb.

Preprocessor defines could disable parts of the code that perhaps aren't necessary for general functionality.

  What platform are you building on? Are you using a debug or production build of HDF5?

Hi Matt,

···

On Aug 25, 2011, at 11:16 AM, Matthew Chambers wrote:

On 8/25/2011 9:39 AM, Quincey Koziol wrote:

Hi Matt,

On Aug 19, 2011, at 9:42 AM, Matthew Chambers wrote:

Sorry I wasn't clear. That's 1.9mb of just HDF5. The total .exe size went from 3.9 to 5.8mb.

Preprocessor defines could disable parts of the code that perhaps aren't necessary for general functionality.

  What platform are you building on? Are you using a debug or production build of HDF5?

The 1.9mb figure comes from a Windows 32-bit release build using MSVC 2008 SP1. My rsp file for building the H5 code looks like:

"H5.c" -Fo"H5.obj"
-TC /O2 /Ob2 /W0 /GR /MD /Zc:forScope /Zc:wchar_t /wd4996 -c
-D_SECURE_SCL=0
-DNDEBUG
-DWIN32
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-D_SECURE_SCL_THROWS=1
-D_SILENCE_DEPRECATION_OF_SECURE_SCL_THROWS
"-I."
"-Ihdf5-1.8.7\c++\src"
"-Ihdf5-1.8.7\src"
"-Ihdf5-1.8.7\src\windows"

I'm using a hacked up Boost.Build Jamfile to do the build using the following H5pubconf.h:
http://codepad.org/wOB3CrAo

I don't remember the exact flags I used with CMake to generate it, but it was pretty basic.

  Hmm, I'm not up on the Windows options, but a library binary on my Mac is ~6MB, so I think you are in the ballpark, or ahead of the game. :slight_smile:

  Quincey