Date: Fri, 2 Nov 2001 16:02:19 -0600 From: Chris Costello <chris@FreeBSD.ORG> To: Alfred Perlstein <bright@mu.org> Cc: gkshenaut@ucdavis.edu, hackers@FreeBSD.ORG Subject: Re: head(1) speedup Message-ID: <20011102160219.A485@holly.calldei.com> In-Reply-To: <20011102113915.O15052@elvis.mu.org>; from bright@mu.org on Fri, Nov 02, 2001 at 11:39:15AM -0600 References: <20011102022333.L15052@elvis.mu.org> <200111021439.fA2EdbP17494@thistle.bogs.org> <20011102113915.O15052@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, November 02, 2001, Alfred Perlstein wrote: > > 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. Well, fgetln should probably be quicker than fread, due to the fact that fgetln will buffer the next incoming line and return a pointer into the stdio internal buffer, while fread has to copy out N times into a separate buffer (also from the read buffer). -- +-------------------+------------------------------------------+ | Chris Costello | ...now touch these wires to your tongue! | | chris@FreeBSD.org | | +-------------------+------------------------------------------+ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011102160219.A485>
