I have 300-500 images and other files that my program uses. I realize I have two options:

  1. Save them in a binary format such as BMP which is loaded dynamically.
  2. Save them in a C source file such as XPM which allows it to be compiled into the program, but it also can be loaded dynamically.

Assuming both are just as easy to implement and I don't require dynamic loading, what are benefits of each method?

How would the loading/startup speed compare?

2 Answers 2


Also remember,

  1. You will need a rebuild of your program every time you change an image (This is prior to release).
  2. Editing / previewing the image is crazy hard when it is embedded in your program.
  3. Program bloat.I would argue this forces the OS to load the entire program when some images aren't necessary - but this is very OS implementation dependent.
  4. Localization / having multiple versions per your customer needs is a pain when you embed.
  • Having to rebuild every time an image changes is no more onerous than having to rebuild after each source file change. A file change is a file change. Mar 17, 2012 at 20:01
  • 1
    Have you done builds that take 3-4 hrs Donal? It matters as project gets bigger. Mar 18, 2012 at 15:51

With the first choice you possibly decrease memory footprint (by loading only what you want), but if it will ever show up depends on the OS you use — if the OS mmaps the executable, you'll probably get nothing.

With the second one you save yourself a little bit of deployment hassle. Also, if you're going for a portable distribution stored on a flash stick, a single file is much quickier to read at once than hundreds of small ones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.