[Xorp-hackers] Re: Size of xorps binaries

Jonathan Day imipak@yahoo.com
Sat, 10 Sep 2005 16:41:21 -0700 (PDT)


That does seem excessively large. One person mentioned
that automake doesn't support a mix of static and
dynamic libraries, but if you have a lower-level
automake for each library, and have them cascading,
you should be able to get round that.

Alternatively, don't link at all and use dlopen() to
access the libraries on use. I believe this is how
Apache handles DSO objects. Since Apache allows a mix
of static and DSO objects, it may be possible to
borrow ideas from their configuration code on how to
mix-n-match.

I'd also check the compiler version. If you're using
GCC, the 4.x.y series is known to not optimize nearly
as well as the later 3.x.y series. This'll be cured,
but it's something to be aware of for right now.

Also if you're using GCC, try using -O1 for your
flags, then try -Os. After each case, strip the
binaries. These use somewhat different optimizations
and therefore the code size will likely differ between
them. There is absolutely no way to be sure which will
be the smaller, for any given program, in advance. You
may also want to add -funit-at-a-time to that, as that
optimizes over a larger segment of code at a time.

If you know your configuration is going to be highly
stable, you MAY (absolutely no guarantees on this) be
able to eke out a little bit more by
-fprofile-generate on the first compile. You then run
the program (which will absolutely crawl!) to generate
a profile of how the code flows. You then recompile
using -fprofile-use, which uses the gathered data to
make better choices on how the code should be
optimized.

If (and only if) you are compiling for an Intel
processor, the Intel compiler may be a better bet,
precisely because everything is static. (The Intel
compiler can produce poorer code than GCC for AMD
processors, won't work at all for non-ix86, and isn't
guaranteed to produce code GCC will link with.)

After all that, you will have one or more of the
following:

(a) have smaller code
(b) have faster code
(c) a PhD in Linux compilers

Jonathan

On 9/10/05, Kristian Larsson <kristian@juniks.net>
wrote:
>
> I just noticed after compiling xorp on my Linux
> laptop the size of the binaries are approximately
> twice that of the binaries compiled on a FreeBSD
> machine. Why is this?
> The xorpsh is just huge - 26MB! And the bgp
> process weighs in at a hefty 44MB.
>
> Could this also be the reason it takes ~30 seconds
> to start the fea, rib and an ospf process?
> IMHO that's a very long time.
>
> Anything that could be fixed or is it something
> you just have to accept?
>
> //Kristian
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com