From owner-freebsd-current Thu Oct 31 6:32:36 2002 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 29CAF37B401 for ; Thu, 31 Oct 2002 06:32:35 -0800 (PST) Received: from smtp01.iprimus.net.au (smtp01.iprimus.net.au [210.50.30.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id B838143E88 for ; Thu, 31 Oct 2002 06:32:33 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.113.24]) by smtp01.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Fri, 1 Nov 2002 01:32:25 +1100 Received: from dilbert.robbins.dropbear.id.au (rwejqhbw5nx2gsko@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id g9VEWIbo037385; Fri, 1 Nov 2002 01:32:19 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id g9VEWIAN037384; Fri, 1 Nov 2002 01:32:18 +1100 (EST) (envelope-from tim) Date: Fri, 1 Nov 2002 01:32:17 +1100 From: Tim Robbins To: Nate Lawson Cc: current@FreeBSD.ORG Subject: Re: libc size Message-ID: <20021101013217.A36373@dilbert.robbins.dropbear.id.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from nate@root.org on Wed, Oct 30, 2002 at 12:46:15PM -0800 X-OriginalArrivalTime: 31 Oct 2002 14:32:26.0206 (UTC) FILETIME=[5553E7E0:01C280EA] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Oct 30, 2002 at 12:46:15PM -0800, Nate Lawson wrote: > After a discussion on cvs-all regarding size of our libc, I wrote a quick > script to see where the problems are. A cursory glance at its output > shows there are numerous things we can improve, including: > > * setproctitle(3) uses 4k of static scratch buffers when it could > allocate these on the stack (let alone reducing the length of the > proc title to something more reasonable than 2k). > > * vfwprintf and vfprintf are near duplicates of each other (in fact, > the former is derived from the latter). Each uses 14k of text so > this could be split in half by combining them and selecting different > behavior with a flag. They are similar enough at the C source level to be merged into a single source file (in fact, Microsoft's C library does this), but they are probably not similar enough at the machine code level to merge and save text space. I have no idea how you could merge them in C to save a significant amount of text space given that sizeof(char) != sizeof(wchar_t). Basically, if you don't want wide character printf/scanf support in libc for some kind of embedded system, remove them from stdio/Makefile.inc. Nothing in the base system uses them, and few programs in the ports collection do either. You could also replace the locale stuff with the dummy versions from 4.4BSD if you don't want it (see OpenBSD's src/lib/libc/stdlib/multibyte.c, etc.). Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message