From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 3 09:11:55 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E445C1065672; Wed, 3 Mar 2010 09:11:55 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id A3D0D8FC22; Wed, 3 Mar 2010 09:11:55 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 0C47C730A1; Wed, 3 Mar 2010 10:04:56 +0100 (CET) Date: Wed, 3 Mar 2010 10:04:56 +0100 From: Luigi Rizzo To: Garrett Cooper Message-ID: <20100303090456.GA14140@onelab2.iet.unipi.it> References: <201003030205.o2325AMY010089@svn.freebsd.org> <4B8DD54F.6060302@FreeBSD.org> <7d6fde3d1003030044h4da7ed2ch1839ea769190bd2b@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d6fde3d1003030044h4da7ed2ch1839ea769190bd2b@mail.gmail.com> User-Agent: Mutt/1.4.2.3i Cc: Maxim Sobolev , freebsd Subject: Re: svn commit: r204615 - head/sbin/newfs X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2010 09:11:56 -0000 On Wed, Mar 03, 2010 at 12:44:06AM -0800, Garrett Cooper wrote: ... > Maxim, > > Xin Li has a point. I ran some tests and the ad hoc parsing function > eats up more memory than expand_number(3) [*]: as someone reminded me, a static library only brings in the archive members you actually use, whereas with a dinamic library you are forced, at runtime, to bring in the entire library (which requires duplicating the static data at least). So i suspect that even if other programs on the same system already use libutil, just the library overhead is more than the cost of a single function. If one is really concerned with memory usage and at the same time wants (for the good reasons mentioned in the thread) to reuse the expand_number code, the it seems that the best approach is force static link with libutil (to bring in just the function you need) and use the default approach for the rest. cheers luigi