Shared vs static link performance hit --and Windows?

Martin v. Löwis martin at v.loewis.de
Wed Jul 9 15:35:25 EDT 2003


Andrew MacIntyre <andymac at bullseye.apana.org.au> writes:

> The important distinction between Win32+OS/2 and Unix is that the dynamic
> linkage uses relocation fixup records to relocate Windows (& OS/2) DLLs,
> whereas the dynamic linkage on Unix does not support the relocation action
> for shared objects - hence the use of PIC on Unix.

That is not the case. Most recent Unix versions (Solaris, Linux, most
likely others) support dynamic relocations in shared libraries just
fine. Linux, for example, maps all code segments copy-on-write, so
sharing is given up only for the pages that need relocations.

On such systems, use of PIC is only for performance, to save the
relocations. Notice that this use is often questioned, as you have to
trade runtime efficiency due to the loss of general-purpose registers
to the PIC implementation, on particular on x86. So for long-running
applications, it would be better to accept the relocations at start-up
time, and get better performance during the computations.

Regards,
Martin




More information about the Python-list mailing list