From owner-freebsd-current@FreeBSD.ORG Tue May 1 11:54:07 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17B0F106566B for ; Tue, 1 May 2012 11:54:07 +0000 (UTC) (envelope-from erik@cederstrand.dk) Received: from csmtp2.one.com (csmtp2.one.com [91.198.169.22]) by mx1.freebsd.org (Postfix) with ESMTP id C56D68FC12 for ; Tue, 1 May 2012 11:54:06 +0000 (UTC) Received: from [192.168.187.69] (unknown [87.54.33.251]) by csmtp2.one.com (Postfix) with ESMTPA id 3E13E303DA1E; Tue, 1 May 2012 11:53:59 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Erik Cederstrand In-Reply-To: Date: Tue, 1 May 2012 13:53:58 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20120426093548.GR2358@deviant.kiev.zoral.com.ua> <20120426134140.GF14350@lo0.su> <4F99ACF9.2050609@infracaninophile.co.uk> <42D8809D-0E99-47A5-802F-71991B5B0B8D@cederstrand.dk> To: Tim Kientzle X-Mailer: Apple Mail (2.1257) Cc: freebsd-current FreeBSD Subject: Re: [RFC] Un-staticise the toolchain X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 01 May 2012 11:54:07 -0000 Den 01/05/2012 kl. 07.52 skrev Tim Kientzle: >=20 > On Apr 30, 2012, at 6:41 AM, Erik Cederstrand wrote: >>=20 >> Can anyone explain to me why the dynamically linked version is = significantly slower? What are the extra steps involved compared to a = statically linked binary? >=20 > At the risk of dramatically over-simplifying=85. >=20 > When a static binary is started by the kernel, it does the following: > * Initializes some libc internals. > * Calls main. >=20 > When a dynamic binary is started by the kernel, it does the following: > * Initializes some libc internals. > * For every dynamic library referenced by this executable: > - loads the dynamic library into memory > - fixes up references > * Calls main >=20 > The process of loading the required libraries and fixing up references > can be quite time-consuming. Thanks for the explanation. In the previous 'make index' benchmark by = Chris, make is called very often, which means the dynamic libraries = should already be loaded into memory after the first run, right? Which = means the extra time is being spent fixing up references? Erik=