From owner-freebsd-current@FreeBSD.ORG Sun May 25 09:59:26 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 3602E37B401 for ; Sun, 25 May 2003 09:59:26 -0700 (PDT) Received: from thuis.piwebs.com (t-indiv5-84.athome.tue.nl [131.155.241.84]) by mx1.FreeBSD.org (Postfix) with SMTP id 17DE243FAF for ; Sun, 25 May 2003 09:59:23 -0700 (PDT) (envelope-from avleeuwen@piwebs.com) Received: (qmail 8327 invoked by uid 85); 25 May 2003 17:01:18 -0000 Received: from avleeuwen@piwebs.com by thuis.piwebs.com by uid 82 with qmail-scanner-1.15 (uvscan: v4.1.60/v4210. spamassassin: 2.x. Clear:SA:0(-5.0/5.0):. Processed in 11.283167 secs); 25 May 2003 17:01:18 -0000 X-Spam-Status: No, hits=-5.0 required=5.0 Received: from unknown (HELO 192.168.0.109) (192.168.0.109) by 0 with SMTP; 25 May 2003 17:01:06 -0000 From: Arjan van Leeuwen To: "Matthew N. Dodd" Date: Sun, 25 May 2003 18:59:09 +0200 User-Agent: KMail/1.5.2 References: <20030525061524.H30007@sasami.jurai.net> <20030525084629.R30007@sasami.jurai.net> In-Reply-To: <20030525084629.R30007@sasami.jurai.net> MIME-Version: 1.0 Content-Disposition: inline X-UID: 379 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200305251859.09670.avleeuwen@piwebs.com> 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 16:59:26 -0000 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" 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.