ibex in under half a megabyte

Adam Megacz <[email protected]> Mon, 01 Mar 2004 01:42:38 -0800
Newsgroups gmane.comp.java.xwt.announce,gmane.comp.java.xwt.core
Organization XWT
Message-ID <[email protected]>
It's true; read 'em and weep:

  http://www.megacz.com/tmp/ibex-skinny.linux

497kb.  Aw yeah.

I'll be checking in org.ibex.util.NanoGoat tomorrow, which does
agressive dead-code and reachability analysis on Java .class files
(which are then fed to gcj).  I also tuned up the optimization flags
we use and also added a new option to gcc that disables [most of]
GCJ's reflection data (this option will probably go mainstream in gcc
3.4 or 3.5, but right now we've got the inside track).  At some point
I'll probably make NanoGoat usable outside of ibex; right now it makes
a lot of ibex-specific assumptions.

This turned out to be a huge task, and I'd been loathing it for a long
time, but ultimately it had to happen before Nitrogen goes final.  A
3mb download just doesn't cut it.  Anyways, as I see it, this was the
last "massive task" to be completed.  Ever since the original Lithium
release (1.5mb) I've been promising people that I could cram this
thing into 500kb, and it feels good to have finally made good on that
promise.

It's clear sailing from here...

Sorry I've been incommunicado the last 2-3 weeks; optimization work
like this requires 100% of my attention for a contiguous period of
time -- I have to juggle such a ridiculous amount of tedious data (gcc
internal data structures, libgcj's object layout formats, Java class
file formats, etc) that I have to stop working on everything else in
order to do it... otherwise my brain suffers from cache thrash.  I
pretty much haven't done anything other than this and my research
project (for the Berkeley WRC) in the last two and a half weeks.

Lastly, big props to Joshua Gertzen for pointing me at UPX, the
Ultimate Packer for eXecutables.  It turns your binary into a
super-compressed, self-extracting binary, and it works on both Linux
and Windows binaries.  That's a substantial part of the smaller binary
size; it beats bzip because it's specialized for executable binaries.

Here's a breakdown of where all the bits wind up.  It's a bit out of
date; I did the analysis back when I was still stuck at 600kb:

  http://wiki.xwt.org/Wiki.jsp?page=BinarySize

  - a

[*] BTW, for the binary above I took out libjpeg, 8-bit colormap
    support, and MIPSApps (freetype/libmspack).  The first two only
    add about 50kb (I wanted the demo to be under 500kb).  I have a
    plan for reintegrating MIPSApps without bloating things too much;
    I think we can stay under 750kb for sure.

-- 
"It's lucky," he added, after a pause, "that there are such a lot of
islands in the world.  I almost envy you, Mr. Watson."

                                                   -- Mustapha Mond

_______________________________________________
http://lists.xwt.org/listinfo/announce