From owner-freebsd-current@FreeBSD.ORG Sun May 25 06:03:25 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7F5A37B401 for ; Sun, 25 May 2003 06:03:25 -0700 (PDT) Received: from sasami.jurai.net (sasami.jurai.net [66.92.160.223]) by mx1.FreeBSD.org (Postfix) with ESMTP id 060FC43F93 for ; Sun, 25 May 2003 06:03:25 -0700 (PDT) (envelope-from mdodd@FreeBSD.ORG) Received: from sasami.jurai.net (sasami.jurai.net [66.92.160.223]) by sasami.jurai.net (8.12.9/8.12.9) with ESMTP id h4PD3O3q085047; Sun, 25 May 2003 09:03:24 -0400 (EDT) (envelope-from mdodd@FreeBSD.ORG) Date: Sun, 25 May 2003 09:03:24 -0400 (EDT) From: "Matthew N. Dodd" X-X-Sender: winter@sasami.jurai.net To: Dag-Erling Smorgrav In-Reply-To: Message-ID: <20030525084629.R30007@sasami.jurai.net> References: <20030525061524.H30007@sasami.jurai.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Bang Jun-Young cc: current@FreeBSD.ORG Subject: Re: Preliminary ELF prebinding patches available. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 May 2003 13:03:26 -0000 On Sun, 25 May 2003, Dag-Erling Smorgrav wrote: > "Matthew N. Dodd" 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. -- | Matthew N. Dodd | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD | | winter@jurai.net | 2 x '84 Volvo 245DL | ix86,sparc,pmax | | http://www.jurai.net/~winter | For Great Justice! | ISO8802.5 4ever |