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#70036: a fix that Date: Fri, 19 Apr 2024 14:01:46 +0300 Message-ID: <86r0f1bopx.fsf@gnu.org> References: <4e670617-6483-4159-a5cf-27a921764c38@email.android.com> <864jbxden1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14893"; mail-complaints-to="usenet@ciao.gmane.io" Cc: felician.nemeth@gmail.com, 70036@debbugs.gnu.org, theo@thornhill.no To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 19 13:04:43 2024 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 1rxm2r-0003ZA-O3 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Apr 2024 13:04:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxm2M-0002M6-8T; Fri, 19 Apr 2024 07:04:15 -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 1rxm18-0001t4-T2 for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 07:03:05 -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 1rxm14-0000U3-U0 for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 07:02:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxm1H-00069e-Lz for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 07:03:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Apr 2024 11:03:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70036 X-GNU-PR-Package: emacs Original-Received: via spool by 70036-submit@debbugs.gnu.org id=B70036.171352454123392 (code B ref 70036); Fri, 19 Apr 2024 11:03:03 +0000 Original-Received: (at 70036) by debbugs.gnu.org; 19 Apr 2024 11:02:21 +0000 Original-Received: from localhost ([127.0.0.1]:58074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxm0Y-00064q-A2 for submit@debbugs.gnu.org; Fri, 19 Apr 2024 07:02:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxm0R-00063O-Vc for 70036@debbugs.gnu.org; Fri, 19 Apr 2024 07:02:15 -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 1rxm07-0000JZ-Dh; Fri, 19 Apr 2024 07:01:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=eDTCHQZA2H3voe0RDHNckKHrP0Svf5M048pt27BB0kg=; b=GdAQi0lTk68Qfi1Z4aor 4O9UnTmHrU1k2YCU//Jn5d7wYzhsWl71tm3Ub8UjCkFAhx0XF2fcIHPJiNHB55gtH9dbGoV5b6StT Nhd0LMKS4gnRLfI4NrCmQ1+PVsKGYzJ2H26rQJp7p/Yo1DJlz5WMqDwIAa8/fTAsxOC7dqZq/bQam 49DFK6Ma1luiD50NBonK0Q44GN7M5qYCtumdn7y3vRqepNnDWVbgSmkYseOp6fGYDo/QWeSMNsfjs 6SMOjg8Pc4XCfjbgS6K+p7pR/PXZwmYVMC4f5+3YFCN68H2swHGMK/QwLr5KQuuBPiBldJxPy0f5P 7lWok6X6YdFW0g==; In-Reply-To: (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Fri, 19 Apr 2024 09:27:31 +0100) 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:283663 Archived-At: > From: João Távora > Date: Fri, 19 Apr 2024 09:27:31 +0100 > Cc: theo@thornhill.no, felician.nemeth@gmail.com, 70036@debbugs.gnu.org > > > > I still think the cleanest solution is to write file-truename > > > in C. > > > > I explained in that past discussion why this is not simple. So if > > simpler solutions exist, we should prefer them. > > Fair enough. Shifting complexity around is what we do. But > having a performant file-truename is a strategically investment, it's > a very common filesystem primitive that users expect to be as fast > as it can be made. Common Lisp has TRUENAME, Python has 'realpath()', > etc. We could compare (here benchmarks are definitely the best > method) file-truename does much more than just the equivalent of realpath. If all we needed was a single call to realpath, we'd done that in C long ago. The problem with rewriting file-truename in C is that we must be 110% compatible to what the Lisp implementation does, since it's such a low-level API that is used so widely. > > find-buffer-visiting was made much faster lately, but that speedup > > AFAIR shows up only if the session has a lot of buffers, so trying > > these benchmarks in "emacs -Q" will not typically show the effect, and > > could even obscure the file-truename effect as well, because the > > number of calls to file-truename will be much smaller. > > I'm not sure what test you are suggesting. If f-b-v performs _better_ > in "lots of buffers" situation, then we should measure Eglot's performance > in the plausible _worse_ case of few buffers, no? No, IMO we should try it in both "emacs -Q" and in a session with a lot of buffers, to have the performance in its true relevant context. Most real-life Emacs sessions have many more buffers than we have in "emacs -Q". Worst-case testing is not always TRT, because it can skew the perspective and lead to wrong decisions. > > But if calling > > find-buffer-visiting from Eglot can be avoided, that is of course even > > better. > > Yes, that's what my latest patch does. But ideally it would be cleaner > (IMHO) to have a fast usable find-buffer-visiting by speeding > up its underlying file-truename. We did that at least to some extent in the improvements submitted by Ihor and now available on master. From where I stand, we now have a reasonably performant implementation of find-buffer-visiting; I would need benchmarks showing otherwise to change my mind.