From owner-freebsd-hackers Tue Jul 27 9:11:46 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail1.its.rpi.edu (mail1.its.rpi.edu [128.113.100.7]) by hub.freebsd.org (Postfix) with ESMTP id BA6F514BEC for ; Tue, 27 Jul 1999 09:11:37 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail1.its.rpi.edu (8.8.8/8.8.8) with ESMTP id MAA22084; Tue, 27 Jul 1999 12:09:42 -0400 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <19990727092941.A34599@mad> References: <19990727082344.B33399@mad>; from Tim Vanderhoek on Tue, Jul 27, 1999 at 08:23:44AM -0400 <19990727082344.B33399@mad> Date: Tue, 27 Jul 1999 12:09:35 -0400 To: Tim Vanderhoek , Dag-Erling Smorgrav From: Garance A Drosihn Subject: Re: replacing grep(1) Cc: hackers@FreeBSD.ORG, howardjp@wam.umd.edu Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 9:29 AM -0400 7/27/99, Tim Vanderhoek wrote: > On a file with 100000+ lines, the speed difference is rather > restrictive. [...] Only about 10% of the time is spend in > procline(). There seems to be a lot of unnecessary strncpy() > that could be _easily_ avoided if free() on util.c:130 was > avoided, but I'll let the authors speak first. :-) Hmm, strncpy? Are these calls which really want strncpy for what it was originally designed for, or are they just trying to prevent buffer overruns? If it's the buffer-overrun answer, then maybe this would be a good test case for using strlcpy instead of strncpy, and see if it makes a performance difference (since the code won't waste it's time nulling-out bytes that don't need to be nulled-out). --- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or drosih@rpi.edu Rensselaer Polytechnic Institute To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message