From owner-freebsd-bugs@FreeBSD.ORG Sun Apr 20 01:30:04 2003 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 2997D37B401 for ; Sun, 20 Apr 2003 01:30:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3CBC43F75 for ; Sun, 20 Apr 2003 01:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h3K8U3Up097537 for ; Sun, 20 Apr 2003 01:30:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h3K8U3x3097536; Sun, 20 Apr 2003 01:30:03 -0700 (PDT) Date: Sun, 20 Apr 2003 01:30:03 -0700 (PDT) Message-Id: <200304200830.h3K8U3x3097536@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: David Schultz Subject: Re: bin/51151: du hardlinkmatching is slow - fix included X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Schultz List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Apr 2003 08:30:04 -0000 The following reply was made to PR bin/51151; it has been noted by GNATS. From: David Schultz To: Peter van Dijk Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/51151: du hardlinkmatching is slow - fix included Date: Sun, 20 Apr 2003 01:27:24 -0700 On Sat, Apr 19, 2003, Peter van Dijk wrote: > + snprintf(s, 32, "%u:%u", dev, ino); > + > + if(tree_srch(&linktree, strcmp, s)==0) > + { > + tree_add(&linktree, strcmp, s, 0); > + return(0); > + } > + else > + { > + free(s); > + return(1); > + } A hash table would be more appropriate here. You could even preserve the original behavior of making infrequent calls to malloc() and most of the original code by using open addressing. In any case, pulling in another library is probably not desirable. If you would like to revise this patch, I would be happy to help you get it committed. You might also want to take a look at style(9).