From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64735: 29.0.92; find invocations are ~15x slower because of ignores Date: Thu, 20 Jul 2023 08:00:52 +0300 Message-ID: <837cqv41ob.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31691"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64735@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 20 07:01:39 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qMLnF-000814-UH for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Jul 2023 07:01:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMLms-00043H-Ed; Thu, 20 Jul 2023 01:01:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMLmg-00042R-HQ for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2023 01:01:06 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMLmg-0000DF-7x for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2023 01:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qMLmg-0000eL-3M for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2023 01:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jul 2023 05:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64735 X-GNU-PR-Package: emacs Original-Received: via spool by 64735-submit@debbugs.gnu.org id=B64735.16898292352447 (code B ref 64735); Thu, 20 Jul 2023 05:01:02 +0000 Original-Received: (at 64735) by debbugs.gnu.org; 20 Jul 2023 05:00:35 +0000 Original-Received: from localhost ([127.0.0.1]:57476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMLmF-0000dP-Bd for submit@debbugs.gnu.org; Thu, 20 Jul 2023 01:00:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMLmD-0000dD-OT for 64735@debbugs.gnu.org; Thu, 20 Jul 2023 01:00:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMLm5-0008Tb-BP; Thu, 20 Jul 2023 01:00:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Qajid7jJKHLDlWyI8UooSVse/iLLIIrDfCgNsoUijCc=; b=mRBs5bgjjFVS ZzzXHzH0TkiBLN3rKMY95qLleqgw82LrS1lYfXqAtG0RXv1x4eZuoZMeX+egx38EJI8gHOsapm12h hPKg1JyObjcAOQwZrqRmrqQOE6a6PpGiYfEN/gwLFiNeub8SZ2MhmVPj13Sgl1xlOj6ON31DVdQQu G/b/jDi5omqsJGE9fvwmhtk1OzHng+MY8RbGn4b4/S4MRg78LlqYOV/mJpFiUtUqs2Lhcz+w0G6AR XGVue1tIE5jH98GyELqtW5XbqdNPQskgczRXdYqnaJ28521TSCjrgWbd+h5257p72/lXeCb/yM3vv Hft2E/bOMN9zxsGcUuJ/lw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMLm1-0002Ui-EF; Thu, 20 Jul 2023 01:00:24 -0400 In-Reply-To: (message from Spencer Baugh on Wed, 19 Jul 2023 17:16:31 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265565 Archived-At: > From: Spencer Baugh > Date: Wed, 19 Jul 2023 17:16:31 -0400 > > > Several important commands and functions invoke find; for example rgrep > and project-find-regexp. > > Most of these add some set of ignores to the find command, pulling from > grep-find-ignored-files in the former case. So the find command looks > like: > > find -H . \( -path \*/SCCS/\* -o -path \*/RCS/\* [...more ignores...] \) > -prune -o -type f -print0 > > Alas, on my system, using GNU find, these ignores slow down find by > about 15x on a large directory tree, taking it from around .5 seconds to > 7.8 seconds. > > This is very noticeable overhead; removing the ignores makes rgrep and > other find-invoking commands substantially faster for me. grep-find-ignored-files is a customizable user option, so if this slowdown bothers you, just customize it to avoid that. And if there are patterns there that are no longer pertinent or rare, we could remove them from the default value. I'm not sure we should bother more than these two simple measures. > The overhead is linear in the number of ignores - that is, each > additional ignore adds a small fixed cost. This suggests that find is > linearly scanning the list of ignores and checking each one, rather than > optimizing them to a single regexp and checking that regexp. If it uses fnmatch, it cannot do it any other way, I think