From owner-freebsd-hackers Fri Nov 2 9:39:17 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 7785F37B401 for ; Fri, 2 Nov 2001 09:39:15 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 7443681D05; Fri, 2 Nov 2001 11:39:15 -0600 (CST) Date: Fri, 2 Nov 2001 11:39:15 -0600 From: Alfred Perlstein To: gkshenaut@ucdavis.edu Cc: hackers@FreeBSD.ORG Subject: Re: head(1) speedup Message-ID: <20011102113915.O15052@elvis.mu.org> References: <20011102022333.L15052@elvis.mu.org> <200111021439.fA2EdbP17494@thistle.bogs.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200111021439.fA2EdbP17494@thistle.bogs.org>; from greg@bogslab.ucdavis.edu on Fri, Nov 02, 2001 at 06:39:36AM -0800 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 * Greg Shenaut [011102 08:42] wrote: > In message <20011102022333.L15052@elvis.mu.org>, Alfred Perlstein cleopede: > >can someone please check this out, it makes "head -n" about five > >times faster. (also nukes a 'register', sorry :)) > > I'm curious--does using fgetln here always result in a win, or just > with short lines? I'm thinking of the impact of realloc and memcpy > on speed. Ugh, I should have checked that, my guess is that performance isn't going ot be much worse, if there is a real problem I'll rework it some more, possibly using fread instead of fgetln. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' http://www.morons.org/rants/gpl-harmful.php3 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message