Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 May 2003 18:59:09 +0200
From:      Arjan van Leeuwen <avleeuwen@piwebs.com>
To:        "Matthew N. Dodd" <mdodd@FreeBSD.ORG>
Cc:        current@freebsd.org
Subject:   Re: Preliminary ELF prebinding patches available.
Message-ID:  <200305251859.09670.avleeuwen@piwebs.com>
In-Reply-To: <20030525084629.R30007@sasami.jurai.net>
References:  <20030525061524.H30007@sasami.jurai.net> <xzpaddb8ab8.fsf@flood.ping.uio.no> <20030525084629.R30007@sasami.jurai.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Do I need to recompile applications to use prebinding?

Arjan

On Sunday 25 May 2003 15:03, Matthew N. Dodd wrote:
> On Sun, 25 May 2003, Dag-Erling Smorgrav wrote:
> > "Matthew N. Dodd" <mdodd@FreeBSD.ORG> writes:
> > > I've implemented per-executable ELF prebinding:
> >
> > Could you explain briefly what prebinding does?
>
> (This isn't as brief as you or I hoped I suspect.)
>
> Relocatable objects (executables and libraries) contain elements that
> require relocation before the are usable.  In some cases this relocation
> requires symbols to be located and resolved.  Resolving these symbols and
> performing the lookups imposes some execution overhead.  By 'prebinding'
> we can do as much of this work beforehand and speed up the actual
> relocation process.
>
> The short answer is that things like KDE and other library happy
> executables take a little less time to load.
>
> Consider this program:
>
> # cat test.c
> int main (int argc, char *argv[]) { return (0); }
> # cc -o test test.c
> # ldd test
> test:
>         libc.so.5 => /usr/lib/libc.so.5 (0x28076000)
> ...
>
> Using a simple execloop (1000 iterations) and time(1):
>
>  normal:  0.734u 4.395s 0:07.55 67.8%     13+163k 0+0io 0pf+0w
> prebind:  0.396u 3.777s 0:05.26 79.0%     16+173k 0+0io 0pf+0w
>  static:  0.000u 0.663s 0:01.06 62.2%     56+186k 0+0io 0pf+0w
>
> Now lets link test.c with lots of useless libraries:
>
> # cc -Wall -o test test.c -lalias -lasn1 -latm -lbsdxml -lbz2 -lc -lc_r
> -lcalendar -lcam -lcom_err -lcrypt -lcrypto -ldevinfo -ldevstat -ldialog
> -ledit -lfetch -lform -lftpio -lg2c -lgeom -lgnuregex -lhistory -lipsec
> -lipx -lisc -lm -lmd -lmenu -lmilter -lmp -lncp -lncurses -lnetgraph
> -lopie -lpam -lpanel -lpcap -lradius -lreadline -lroken -lrpcsvc -lsbuf
> -lsmb -lssh -lssl -lstdc++ -ltacplus -lufs -lugidfw -lusbhid -lutil -lvgl
> -lwrap -lxpg4 -lypclnt -lz -lkvm
>
> (We'll run execloop with only 100 iterations)
>
>  normal:  14.003u 4.263s 0:23.14 78.9%    5+174k 0+0io 0pf+0w
> prebind:  1.108u 3.231s 0:05.46 79.3%     6+182k 0+0io 0pf+0w
>  static:  0.000u 0.062s 0:00.15 40.0%     66+229k 0+0io 0pf+0w
>
> This is just a quick and dirty example mind you; I should really run
> things with 10000 iterations and make execloop do its own timing
> statistics etc.



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