Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 1997 00:09:45 -0700 (PDT)
From:      Sean Eric Fagan <sef@Kithrup.COM>
To:        hackers@freebsd.org
Subject:   Re: shared libraries?
Message-ID:  <199708280709.AAA15241@kithrup.com>
References:  <199708280507.AAA07664@dyson.iquest.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.BSF.3.96.970828022111.28125A-100000.kithrup.freebsd.hackers@server.local.sunyit.edu> you write:
>I'm not arguing, just asking, why would using shared libraries hurt?

For several reasons:

1.  the position-independent code is much worse, performance- and size-wise,
than the non-PIC versions.  On the x86, this is almost worst case, because
of the lack of general-purpose registers.

2.  When using a shared library, the ENTIRE IMAGE gets pulled in; when using
a normal library, only the needed bits are pulled in.  Programs that need
only a few routines may, as a result, be larger because of the extra
baggage.  Yes, it's shared, but it still takes up some space.  And if the
program in question is used a lot (e.g., /bin/sh), then the program text
will be shared anyway, thus making up for the lack of shared library.

3.  The shared library code has to jump through some hoops in order to allow
for user-redefined functions.  E.g., malloc().  This also results in some
more performance loss.

The *big* advantage of shared libraries is that *disk space* is smaller.
But this does come at a cost.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708280709.AAA15241>