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: Wed, 26 Jul 2023 05:28:13 +0300 Message-ID: <7163164f-28a3-13b0-ffa8-eb1fc8b0b569@gutov.dev> References: <1fd5e3ed-e1c3-5d6e-897f-1d5d55e379fa@gutov.dev> <87wmyupvlw.fsf@localhost> <5c4d9bea-3eb9-b262-138a-4ea0cb203436@gutov.dev> <87tttypp2e.fsf@localhost> <87r0p030w0.fsf@yahoo.com> <83sf9f6wm0.fsf@gnu.org> <83sf9eub9d.fsf@gnu.org> <2d844a34-857d-3d59-b897-73372baac480@gutov.dev> <83bkg2tsu6.fsf@gnu.org> <83bd4246-ac41-90ec-1df3-02d0bd59ca44@gutov.dev> <834jlttv1p.fsf@gnu.org> <937c3b8e-7742-91b7-c2cf-4cadd0782f0c@gutov.dev> <83a5vlsanw.fsf@gnu.org> <69a98e2a-5816-d36b-9d04-8609291333cd@gutov.dev> <877cqniyyk.fsf@catern.com> 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="3515"; 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: luangruo@yahoo.com, sbaugh@janestreet.com, Eli Zaretskii , yantar92@posteo.net, 64735@debbugs.gnu.org To: sbaugh@catern.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 26 04:29:18 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 1qOUH6-0000jx-BB for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jul 2023 04:29:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOUGu-0003Yx-Bh; Tue, 25 Jul 2023 22:29: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 1qOUGs-0003Yj-TZ for bug-gnu-emacs@gnu.org; Tue, 25 Jul 2023 22:29:03 -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 1qOUGs-0005e5-Jo for bug-gnu-emacs@gnu.org; Tue, 25 Jul 2023 22:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qOUGs-0004xO-Dd for bug-gnu-emacs@gnu.org; Tue, 25 Jul 2023 22:29: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: Wed, 26 Jul 2023 02:29: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.169033851519020 (code B ref 64735); Wed, 26 Jul 2023 02:29:02 +0000 Original-Received: (at 64735) by debbugs.gnu.org; 26 Jul 2023 02:28:35 +0000 Original-Received: from localhost ([127.0.0.1]:47265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qOUGR-0004wi-2b for submit@debbugs.gnu.org; Tue, 25 Jul 2023 22:28:35 -0400 Original-Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:34069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qOUGP-0004wT-Ay for 64735@debbugs.gnu.org; Tue, 25 Jul 2023 22:28:33 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id E7F932B0016E; Tue, 25 Jul 2023 22:28:26 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 25 Jul 2023 22:28:27 -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=fm2; t= 1690338506; x=1690345706; bh=74xdhRfrhO14sFCCEbwcAaJMdU3fv/eJbHD ie3m3Nng=; b=f0o+1Whq+8VKbm+kPc95nPEJCc4ZatfJ6ZyV0Pba678BFiBfk1D sxiclAYFCyn76whDaP37DSWTIvh6bJE8K3N//dX1IRLn+GPDVnmmQnhTJNhP4gsu eMYBY9MRJa9xJCx6nuYo6JbJIe875y9R+in9KG6iKA0kYifljeF4btijmZpoag40 hHj1+MWbFwsgcXST7VD2ZUdi1DLN0RoANmBBgjC8ohRU/dlul+dkGVMORdH6Q102 80GWWg+CPPo+quhb/eH2bzrIQ3w7S/sMcpwUw7/ylQQFtpk/wlGK6nFU0CN+oxOV lb/JtKnKnqnRY841l+MS3a9/O7daR/h6CCg== 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= 1690338506; x=1690345706; bh=74xdhRfrhO14sFCCEbwcAaJMdU3fv/eJbHD ie3m3Nng=; b=ARXXeCKp7e1hGaLdcusSKL+4LEeNrTqqcOiKjvMV12tOe316Ns1 pwJ3HJOIyrKh2xOnYfoY8WFtex0Lo94sN1nCkVk078JwA0+WftVY3fNf5rxwj20w 8oJYSneoGQwQX6M85l+e1KUKTFUOpOlvy9BIb0gKIO4W2M18k+EB1EPO3lDC6DR9 WqWiQROQsprpn8FwS17mcCHAA6BmDALJA/pYhwGkKZ2Q4/u4aQSDjZOGgz5NEVNC G4Hg9mduRh0LupbwAuRpbQbIufLhyeS+Fw0oipqFst7o2hdO5NVMsHwVBzk8vr28 ytLyCYUfltfFFb/Pi5X28NT1EZSUN/Ai2hw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedriedugdehjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeevledv veenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Jul 2023 22:28:14 -0400 (EDT) Content-Language: en-US In-Reply-To: <877cqniyyk.fsf@catern.com> 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:266097 Archived-At: On 25/07/2023 22:16, sbaugh@catern.com wrote: > Dmitry Gutov writes: >>> (my-bench 1 default-directory "") >> >> (("built-in" . "Elapsed time: 1.601649s (0.709108s in 22 GCs)") >> ("with-find" . "Elapsed time: 1.792383s (1.135869s in 38 GCs)") >> ("with-find-p" . "Elapsed time: 1.248543s (0.682827s in 20 GCs)") >> ("with-find-sync" . "Elapsed time: 0.922291s (0.343497s in 10 GCs)")) > > Tangent, but: > > Ugh, wow, call-process really is a lot faster than make-process. I see > now why people disliked my idea of replacing call-process with something > based on make-process, this is a big difference... More like forewarned. Do we want to exchange 25% of performance for extra reactivity? We might. But we'd probably put that behind a pref and have to maintain two implementations. > There's zero reason it has to be so slow... maybe I should try to make a > better make-process API and implementation which is actually fast. > (without worrying about being constrained by compatibility with > something that's already dog-slow) I don't know if the API itself is at fault. The first step should be to investigate which part of the current one is actually slow, I think. But then, of course, if improved performance really requires a change in the API, we can switch to some new one too (which having to maintain at least two implementations for a number of years). BTW, looking at the difference between the with-find-* approaches' performance, it seems like most of it comes down to GC. Any chance we're doing extra copying of strings even when we don't have to, or some inefficient copying -- compared to the sync implementation? E.g. we could use the "fast" approach at least when the :filter is not specified (which is the case in the first impl, "with-find"). The manual says this: The default filter simply outputs directly to the process buffer. Perhaps it's worth looking at.