mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Question re: dynamic linking in musl
Date: Wed, 27 May 2015 15:06:31 +0200	[thread overview]
Message-ID: <20150527130630.GG20259@port70.net> (raw)
In-Reply-To: <5565A812.9090004@gmail.com>

* Alex Dowad <alexinbeijing@gmail.com> [2015-05-27 13:18:42 +0200]:
> On 27/05/15 12:40, Alexander Monakov wrote:
> >That is not how ELF symbol lookup works.  Simply put, the symbol should be
> >taken from whatever first module in the whole lookup chain provides it; e.g.
> >if the executable exports a function that is also exported in libX11, the
> >executable's definition prevails.
> OK, I get it. So dynamic linking has O(n^2) runtime, with "n" being the
> number of dynamic libraries you link against!

yes, in the sense that a symbol lookup is O(n) and you may
have O(n) such lookups.

> >Recently I was working on some dynamic linker speedups for musl.  On my
> >testcase, Clang/LLVM with ~100-200 dynamic libraries and ~20000 symbols that
> >need to be resolved in the dynamic linker, I obtained a speedup from 240 ms to
> >110 ms, while glibc needs 50 ms with lazy binding and 140 without.  So while
> >musl's dynamic linker speed can be improved, still rrdtool is doing something
> >odd in the first place if it's performance is bound like that.  I'd like to
> >understand that.  If it's unavoidable, perhaps static linking is appropriate.
> >
> >(I didn't send my dynlink speedup patches yet;  I intend to do that sometime
> >soon)
> That speedup will be very welcome, especially for clang! clang builds are
> noticeably slower than gcc. Looking forward to it.
> 

may be clang should be linked staticly then
(if dynamic linker has meausrable overhead)

btw i recently heard that benchmarks show that
clang compiles very fast.. but only if it was
compiled with gcc.. the irony

...
> cob=(1) /lib/ld-musl-i386.so.1
> cfi=(47) /home/buildozer/aports/main/musl/src/musl-1.1.5/src/exit/atexit.c
...

i386 pic code is slow even if the musl loader
is magically fast so if you care about performance
then static linking is the right solution.


      parent reply	other threads:[~2015-05-27 13:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 10:08 Alex Dowad
2015-05-27 10:40 ` Alexander Monakov
2015-05-27 11:18   ` Alex Dowad
2015-05-27 13:01     ` Alexander Monakov
2015-05-27 13:09       ` Timo Teras
2015-05-27 13:15         ` Alex Dowad
2015-05-27 13:23           ` Timo Teras
2015-05-27 14:06             ` Szabolcs Nagy
2015-05-27 14:06             ` Rich Felker
2015-05-28 14:03               ` Natanael Copa
2015-05-27 13:06     ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150527130630.GG20259@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).