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 09:56:34 +0300 Message-ID: <864jbxden1.fsf@gnu.org> References: <4e670617-6483-4159-a5cf-27a921764c38@email.android.com> 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="4416"; 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 08:57:20 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 1rxiBT-0000uw-V5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Apr 2024 08:57:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxiB2-0007Yj-KF; Fri, 19 Apr 2024 02:56:52 -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 1rxiB1-0007YR-Di for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 02:56:51 -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 1rxiB1-0003Uq-5F for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 02:56:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxiBE-0003I6-Pu for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 02:57:04 -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 06:57:04 +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.171350982212631 (code B ref 70036); Fri, 19 Apr 2024 06:57:04 +0000 Original-Received: (at 70036) by debbugs.gnu.org; 19 Apr 2024 06:57:02 +0000 Original-Received: from localhost ([127.0.0.1]:57162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxiB9-0003HH-Qb for submit@debbugs.gnu.org; Fri, 19 Apr 2024 02:57:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxiB5-0003GB-TS for 70036@debbugs.gnu.org; Fri, 19 Apr 2024 02:56:57 -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 1rxiAm-0003Tq-4T; Fri, 19 Apr 2024 02:56:36 -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=gW+cI2Ux5InfW/YOM+DISzl5FRvkogK8DJRT22Uc4uY=; b=Hs0rGd3vwYn9Kmr3TORT 4QYARexYslpPtmg7hVfEamnUb/Pk4b55uil22oxSFS7Ksrb1puvdLSxsTSXgX+DgeKVL9s5cSP4AG vJ4v5ZsblctGrbnLg826WB6vxJhoy7d++SbZMRbWSEVccZtDjIUBbD/kAZbtW2ju/fni0jL9dIzRf sgf+f3xGlvls3D+c9dhDYoOzZxoInIRdPWev1WTVobKW3Cy+MNfppIV4h0EtZhrBykkZF5W4xuPZE P92oL8QMx6qRTRSxCxIbLokqOW5A0LvU9AtV/GcB5KZ9hPjH4T56j5MrZZ+g8bVN5mS8tX2Kdswr1 eBV3EPra6vPViA==; In-Reply-To: (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Thu, 18 Apr 2024 23:06:47 +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:283637 Archived-At: > From: João Távora > Date: Thu, 18 Apr 2024 23:06:47 +0100 > Cc: Eli Zaretskii , felician.nemeth@gmail.com, 70036@debbugs.gnu.org > > > > Still, for the very little data that there is available, I do take care > > > to put in a much simpler fix that completely fixes the issue - as far as > > > I or anyone reading the available data can see it. > > > > With this I disagree - but I guess I either have miscommunicated or have > > provided unclear profiles or something inbetween. > > I scanned the bug thread twice and couldn't find any other profiles. > There are mentions of textDocument/publishDiagnostics, but no actual > profile data or information of how to see the performance problem. > > Maybe _I_ missed something. But I see you have now sent a perfect > reproduction, so it doesn't matter. There was no need to have any profiles to demonstrate that file-truename is significantly slower than expand-file-name. It should be clear just by looking at what file-truename does and how it does that. Therefore, once I was told that resolving symlinks in Emacs is unnecessary, replacing file-truename with expand-file-name became a no-brainer, regardless of how many or how few percents of CPU time it takes: it's just a waste of CPU cycles. It's only now, that we decided symlinks _should_ be resolved by Emacs, that quantitative performance of the code and the fraction of it due to file-truename becomes relevant, and must be measured and compared with alternatives. > 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. > But if that can't be done, it doesn't seem terribly hard > to get rid of find-buffer-visiting in publishDiagnostics and > still remain symlink-correct. 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. But if calling find-buffer-visiting from Eglot can be avoided, that is of course even better. > That's because every interesting result of find-buffer-visiting > is a buffer for which we've already issued a 'didOpen', which > in turn means we've already called file-truename once for it. > If we cache that result (the basic idea behind the "better fix") > it should be possible to find the buffer quicker just by iterating > the list. That's what I will try to do, using your recipe as > guide. Thanks.