SDL app file size

Discussion in 'Mac Programming' started by Muncher, Mar 18, 2008.

  1. macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #1
    I recently made a demo of a water-sim in C with SDL. When I compiled the program, removed unnecessary files, and ran it through xslimmer, i still had a 28KB app. I realize 4KB comes from info.plist, but why does 7KB of code take 24KB of space?! Can I reduce this any further?

    The reason I'm so obsessive about space comes from the time I've spent programming for microcontrollers. Also, I might try to make a 64kb intro for mac (not a port!) if I can get these apps smaller.
     
  2. macrumors 68040

    Joined:
    Apr 22, 2005
    #2
    Have you actually opened up the .app bundle and looked at what is inside? There are a number of other files that could be in there taking up space.
     
  3. thread starter macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #3
    Yeah, the SDL library takes up almost 1.5MB, and then there are other unused files.
     
  4. macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #4
  5. macrumors 6502

    Joined:
    Jun 16, 2004
    #5
    24KB, or 24MB?
     
  6. thread starter macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #6
    kilobytes. I know, I know, modern computers and all that. I want a 10K file max, and for how much I wrote, that's not asking much.
     
  7. thread starter macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #7
    Hah, I finally got it. I am using iPakk, a command-line tool for packing executables, and I'm not using SDL anymore, but OGL directly, which cuts down on usage. I got everything down to under 8Kb, and the compression ratio will probably get better as I add more stuff to it.
     
  8. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #8
    In another thread we were working on an assembly hello world program. The object file was 364 bytes. 137 of them were non-null. Once it was linked, the resulting file was 8248 bytes. 236 of them were non-null. As was recommended above, hacking on the mach-o format is probably going to be your only way to go. If printing "Hello World!" and returning 0 takes 8248 bytes after linking, you only have 1992 bytes left to play with to do anything useful without playing with the format of the binary yourself. There may be a "cheaper" linker that will optimize for you, but I'm not familiar with anything like that.

    Edit: Too slow, looks like you found something to do the hard hacking for you.
     
  9. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #9
    I am admittedly unfamiliar with executable packing, but this did trim the hello world program down to 3071 bytes, 2414 of which were non-null. Certainly interesting. At least you have some extra bytes to play with now, good luck.

    -Lee
     

Share This Page