Shared library annoyance with gcc-3_0-branch

Oleg Krivosheev kriol@bpmail.fnal.gov
Thu Feb 22 08:06:00 GMT 2001


On Tue, 20 Feb 2001, Linus Torvalds wrote:

> 
> On Tue, 20 Feb 2001, Geert Bosch wrote:
> > 
> > BTW, what is the overhead on Linux for calling routines in dynamic
> > libraries as opposed to code statically linked in? Has anybody done
> 
> It's noticeable, and it depends on the architecture. 
> 
> With static linking, you can often do static optimizations that tend to be
> rather nasty to do on any dynamic libraries. Things like knowing when the
> rotines share GOT entries etc. Things like knowing that you could just use
> a short indirect branch instead of having to go through a register.
> 
> There's also the issue of just loading, which can be expensive in itself.
> However, most cases where you _really_ care, and are willing to work at
> it, can just link statically, I suspect.
> 
> I don't think performance is the first-order worry here. libgcc doesn't
> tend to be _that_ performance-sensitive (if it was, much of it would be
> inlined - but it tends to be used for stuff where the overhead of a
> function call is not all that noticeable).
> 
> 			Linus
> 

i have multihour numerical code with small memory
footprint which runs faster (+20%) while linked
shared vs static. Go figure... ;)

OK



More information about the Gcc mailing list