From owner-freebsd-hackers Thu Nov 14 19:30: 1 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A196137B401 for ; Thu, 14 Nov 2002 19:29:59 -0800 (PST) Received: from alcanet.com.au (mail2.alcanet.com.au [203.62.196.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE46B43E6E for ; Thu, 14 Nov 2002 19:29:57 -0800 (PST) (envelope-from peter.jeremy@alcatel.com.au) Received: from sydsmtp01.alcatel.com.au (IDENT:root@localhost.localdomain [127.0.0.1]) by alcanet.com.au (8.12.4/8.12.4/Alcanet1.3) with ESMTP id gAF3Tl5O031857; Fri, 15 Nov 2002 14:29:48 +1100 Received: from gsmx07.alcatel.com.au ([139.188.20.247]) by sydsmtp01.alcatel.com.au (Lotus Domino Release 5.0.11) with ESMTP id 2002111514294645:8812 ; Fri, 15 Nov 2002 14:29:46 +1100 Received: from gsmx07.alcatel.com.au (localhost [127.0.0.1]) by gsmx07.alcatel.com.au (8.12.5/8.12.5) with ESMTP id gAF3TkRL028255; Fri, 15 Nov 2002 14:29:46 +1100 (EST) (envelope-from peter.jeremy@alcatel.com.au) Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.12.5/8.12.5/Submit) id gAF3TkCV028254; Fri, 15 Nov 2002 14:29:46 +1100 (EST) (envelope-from peter.jeremy@alcatel.com.au) Date: Fri, 15 Nov 2002 14:29:46 +1100 From: Peter Jeremy To: Matthew Dillon Cc: hackers@freebsd.org Subject: Re: cvs commit: src/bin/sleep sleep.c Message-ID: <20021115032946.GP6446@gsmx07.alcatel.com.au> References: <200211132012.gADKCQxr062768@repoman.freebsd.org> <20021113204503.GI9006@vega.vega.com> <20021113.215346.90827277.imp@bsdimp.com> <200211142257.gAEMvdxX071776@apollo.backplane.com> Mime-Version: 1.0 In-Reply-To: <200211142257.gAEMvdxX071776@apollo.backplane.com> User-Agent: Mutt/1.4i X-MIMETrack: Itemize by SMTP Server on SYDSMTP01/AlcatelAustralia(Release 5.0.11 |July 24, 2002) at 15/11/2002 02:29:46 PM, Serialize by Router on SYDSMTP01/AlcatelAustralia(Release 5.0.11 |July 24, 2002) at 15/11/2002 02:29:48 PM, Serialize complete at 15/11/2002 02:29:48 PM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [This doesn't belong in cvs-all and Nate has already made comments in -hackers] On 2002-Nov-14 14:57:39 -0800, Matthew Dillon wrote: > I think the real issue is the bloat in libc. printf() eats 20K, basic > stdio eats 5K. You get 15K of bloat just with a blank main(), a good > chunk of that being malloc() (reasonable in larger programs, ridiculous > in tiny programs where you don't care about malloc() efficiency). As a (partial) counter-argument: For long-running processes that make extensive use of malloc (eg /bin/sh), malloc() 'efficiency' does matter. Likewise, in an embedded environment, the 15KB of text space you save may be more than offset by a malloc implementation that is less frugal in heap space. > Why not create a mini-libc? No language-aware character conversions, > no efficient string or memory functions, no floating point. Just a basic > implementation of the core functionality required for stdio, malloc, > *printf(), string functions, and system calls (which will simply be > borrowed from libc), sufficient for simple binaries. It could be made > compatible with our standard includes (structural bloat != code bloat, > so who cares). I think Nate's got a good point regarding maintainability here. If we do want to create a mini-libc, we need to minimise the amount of code duplication. Note that, based on a quick nm and size on libc.a, we could halve the size of printf() by undefining 'FLOATING_POINT' in vfprintf.c, with virtually no additional maintainability effort. (Xenix/286 used to have both integer-only and FP-aware variants of the standard libraries. The compiler would automatically select the libraries based on FP references in the code. Though I do recall managing to confuse it on one occasion). Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message