From owner-cvs-all@FreeBSD.ORG Tue Mar 9 07:49:40 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EFCCF16A4CE; Tue, 9 Mar 2004 07:49:40 -0800 (PST) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E40843D2F; Tue, 9 Mar 2004 07:49:40 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i29FnYnX021749; Wed, 10 Mar 2004 02:49:34 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i29FnVgC000593; Wed, 10 Mar 2004 02:49:32 +1100 Date: Wed, 10 Mar 2004 02:49:31 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Alexander Kabaev In-Reply-To: <20040309043207.GA65153@kanpc.gte.com> Message-ID: <20040310000922.A5035@gamplex.bde.org> References: <200403090245.i292j0a6035728@repoman.freebsd.org> <20040309032248.GA88649@cat.robbins.dropbear.id.au> <20040309035532.GA88825@cat.robbins.dropbear.id.au> <20040309043207.GA65153@kanpc.gte.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: src-committers@freebsd.org cc: cvs-src@freebsd.org cc: cvs-all@freebsd.org cc: John Birrell cc: Tim Robbins cc: John Birrell Subject: Re: cvs commit: src/lib/libc/stdio _flock_stub.c local.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2004 15:49:41 -0000 On Mon, 8 Mar 2004, Alexander Kabaev wrote: > On Tue, Mar 09, 2004 at 03:05:36PM +1100, John Birrell wrote: > > > > I'm not sure that I agree that applications are 'broken' when they > > use things that are defined in the header file along with the FILE > > structure itself. It's a historical mistake that FILE is not opaque. > I would like to see FILE to become transparent to applications and its > definition moved to the libc-private header file with the specific > purpose of making the hack you mentioned impossible. This would pessimize even getc_unlocked() and putc_unlocked(). getc() and putc() are now extern functions, but the old macro/inline versions are still available as getc_unlocked() and putc_unlocked(). Simple benchmarks for reading a 100MB file on an Athlon XP1600 overclocked show that the function versions are up to 9 times slower: Time to read the file from a disk cache using read(): 0.17 seconds (sys) getc_unlocked() overhead: 0.41 seconds (user) getc() overhead: 1.64 seconds (user) This is with static linkage. Dynamic linkage increases the getc() pessimization significantly: read() time: no significant change getc_unlocked() overhead: 0.44 seconds (user) getc() overhead: 3.62 seconds (user) Bruce Bruce