[BusyBox] idea regarding space savings wrt usage strings

Manuel Novoa III mnovoa3 at bellsouth.net
Tue Jan 30 21:39:50 UTC 2001


Hi everyone,

I've been toying with this idea for a while now, and finally got around today
to looking at it.  Currently the usage strings are stored as individual
strings.  It occurred to me that it might be better to store the combined
strings in one long char array and convert usage calls to use int offsets into
this array.  So, I wrote a little utility to take the standard usage.c file and
dump out a header file of #define's for the offsets and .c file containing one
large char array made up of 0-terminated strings.  (I had to handle the escaped
chars of course).  Only 10 busybox files needed minor (almost trivial) patching.
(although there may be others -- as I said, I only built stock w/o NFS).

Now, this may not seem like it gains you anything, but building the stock
busybox (except for NFS) against uClibc showed a savings in executable size of
almost 900 bytes.  gzip'd sizes of the executables were comparable however.

But, even if this didn't save any space, think of the flexibility we gain.  We
could move all of the usage strings into a file seperate from the executable
(they would have to be built together of course), or we could store the
compressed image in a char array in the executable.

Before I play with this further though, I wanted to see what kind of feedback
there is from other people on the list.

1) Is there any demand for the extra flexibility?

2) Are there people out there who want smaller executable size, althought the
compressed executable size might go up slightly?

Manuel





More information about the busybox mailing list