From owner-freebsd-bugs@FreeBSD.ORG Sat Mar 27 11:40:11 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AF09D16A4CE for ; Sat, 27 Mar 2004 11:40:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A872243D39 for ; Sat, 27 Mar 2004 11:40:11 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2RJeBbv052033 for ; Sat, 27 Mar 2004 11:40:11 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2RJeBgg052032; Sat, 27 Mar 2004 11:40:11 -0800 (PST) (envelope-from gnats) Date: Sat, 27 Mar 2004 11:40:11 -0800 (PST) Message-Id: <200403271940.i2RJeBgg052032@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Valentin Nechayev Subject: Re: gnu/62782: strlcpy performance problem X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Valentin Nechayev List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Mar 2004 19:40:11 -0000 The following reply was made to PR gnu/62782; it has been noted by GNATS. From: Valentin Nechayev To: chc Cc: freebsd-gnats-submit@freebsd.org Subject: Re: gnu/62782: strlcpy performance problem Date: Sat, 27 Mar 2004 21:26:10 +0200 Fri, Feb 13, 2004 at 02:30:21, chc (chc) wrote about "gnu/62782: strlcpy performance problem": c> while (*s++); /* performance problem when src is mmap pointer */ c> Mmap a big file which is above 500M and use strlcpy. I found it was very slow. As mapping is on per-page basis, any implementation of per-char scanning (as required by C-styled string copy) will be much faster than page fault interrupt. So your problem isn't strlcpy slowness, but bad program design: you should not use nul-terminated strings for this task. PR is already closed, but I want add my $0.05 to clarify that it isn't one function problem, but conceptual problem (and strncpy() can't fix it, but can only aggravate). Redesign your program. -netch-