From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#64735: 29.0.92; find invocations are ~15x slower because of ignores Date: Thu, 20 Jul 2023 18:57:00 +0300 Message-ID: References: <1fd5e3ed-e1c3-5d6e-897f-1d5d55e379fa@gutov.dev> <87wmyupvlw.fsf@localhost> <5c4d9bea-3eb9-b262-138a-4ea0cb203436@gutov.dev> <87tttypp2e.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13735"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: Spencer Baugh , 64735@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 20 17:58:29 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 1qMW2t-0003FH-UZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Jul 2023 17:58:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMW2W-0000Hs-E4; Thu, 20 Jul 2023 11:58:04 -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 1qMW2U-0000HA-Nx for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2023 11:58:02 -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 1qMW2U-0004k1-Fe for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2023 11:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qMW2U-00068G-CQ for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2023 11:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jul 2023 15:58: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.168986863223485 (code B ref 64735); Thu, 20 Jul 2023 15:58:02 +0000 Original-Received: (at 64735) by debbugs.gnu.org; 20 Jul 2023 15:57:12 +0000 Original-Received: from localhost ([127.0.0.1]:59535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMW1f-00066i-II for submit@debbugs.gnu.org; Thu, 20 Jul 2023 11:57:11 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:43917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMW1c-00066O-Vu for 64735@debbugs.gnu.org; Thu, 20 Jul 2023 11:57:10 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 753315C006A; Thu, 20 Jul 2023 11:57:03 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 20 Jul 2023 11:57:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1689868623; x=1689955023; bh=z1IsZ/XMTPa5iEDsDduIuDCFm7BcSEM4i1N RFXergfo=; b=ZNJvCK4k2/XFMedHCEzSJAOeRx2vUWk7HvekHvDxtD40sYafr7E 7jkr0HOgwxWCNhyWyD50osd+HUufJPyvVUXrK3oA0v2SIZcbYl1fmq/++ZXgnIZZ W8Jescl4j20XI0W6gQnS63MlMCc6uEZe1NMNMebkN1WWJn6G7CwA/CB3cREnNji7 v3dqV6aS8iMaVcNEsx2Q6RWFQ1XGPsCtiQ1SiLnKDmqvmcJjij4HbMvHuRR9LqkP MYYv5pHMznERxEmCvLOJw0TILcBY83joI1MfzJOWzm1Lo0k9VxqFXhCGrfZdfIV4 Sm+i6Bj8yRSXVrPuy0YOYbREZDd1eH/oU+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1689868623; x=1689955023; bh=z1IsZ/XMTPa5iEDsDduIuDCFm7BcSEM4i1N RFXergfo=; b=Ykajmm7JQDfj6pOc5RNaSu6v4Pg9MUdWnIqA4qiZkkNyJDyFo5X VWVgRh7DP0mpl9PrXOBCMoYSmkQL5DwRfUZ54YjjsUb+RyAmymhbzGujOdcAIVZi hxW9slhl/6i/60Na2akU7u/jpTSuAm+pVBYbjLxmlguMo7HAIrhsf1qmbRjuEFwg llgARL2YpaLOs4cCf6Ti7tTSLA542UJlZVk0JlcvVRgVUQsemAievN/gxOcSpN+/ jLVM0L8Tx/3XTYOQ3pfpn/EZ5TkxCj4Lnigt5FohkH8PEz0V8wLz7+fXrijO55Y/ 0BbBY0qoCV1iccULY+69WraFyMwSambgezw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedtgdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeffhefgkeevheevvdeutedtkeeijeduueejheethedtgfdutdetveffvdevteef ueenucffohhmrghinhephihhvghtihhlrdhorhhgpdihrghnthgrrhelvddruggrthgrne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmihht rhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 20 Jul 2023 11:57:02 -0400 (EDT) Content-Language: en-US In-Reply-To: <87tttypp2e.fsf@localhost> 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:265611 Archived-At: On 20/07/2023 18:42, Ihor Radchenko wrote: > Dmitry Gutov writes: > >>>> ... Last I checked, Lisp-native file >>>> listing was simply slower than 'find'. >>> >>> Could it be changed? >>> In my tests, I was able to improve performance of the built-in >>> `directory-files-recursively' simply by disabling >>> `file-name-handler-alist' around its call. >> >> Then it won't work with Tramp, right? I think it's pretty nifty that >> project-find-regexp and dired-do-find-regexp work over Tramp. > > Sure. It might also be optimized. Without trying to convince find devs > to do something about regexp handling. > > And things are not as horrible as 15x slowdown in find. We haven't compared to the "optimized regexps" solution in find, though. >>> See https://yhetil.org/emacs-devel/87cz0p2xlc.fsf@localhost/ >>> (the thread also continues off-list, and it looks like there is a lot of >>> room for improvement in this area) >> >> Does it get close enough to the performance of 'find' this way? > > Comparable: > > (ignore (let ((gc-cons-threshold most-positive-fixnum)) (benchmark-progn (directory-files-recursively "/home/yantar92/.data" "")))) > ;; Elapsed time: 0.633713s > (ignore (let ((gc-cons-threshold most-positive-fixnum)) (benchmark-progn (let ((file-name-handler-alist)) (directory-files-recursively "/home/yantar92/.data" ""))))) > ;; Elapsed time: 0.324341s > ;; time find /home/yantar92/.data >/dev/null > ;; real 0m0.129s > ;; user 0m0.017s > ;; sys 0m0.111s Still like 2.5x slower, then? That's significant. >> Also note that processing all matches in Lisp, with many ignores >> entries, will incur the proportional overhead in Lisp. Which might be >> relatively slow as well. > > Not significant. > I tried to unwrap recursion in `directory-files-recursively' and tried > to play around with regexp matching of the file list itself - no > significant impact compared to `file-name-handler-alist'. I suppose that can make sense, if find's slowdown is due to it issuing repeated 'stat' calls for every match. > I am pretty sure that Emacs's native file routines can be optimized to > the level of find. I don't know, the GNU tools are often ridiculously optimized. At least certain file paths.