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#74243: [PATCH] Speed up vc-hg-state by treating ignored files as unregistered Date: Wed, 27 Nov 2024 01:26:26 +0200 Message-ID: <802729a0-6937-48a7-9ce5-bd81e8548877@gutov.dev> References: <87mshy7jtp.fsf@melete.silentflame.com> <87r06ytosi.fsf@melete.silentflame.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="31513"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 74243@debbugs.gnu.org To: Sean Whitton , Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 27 00:27:29 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 1tG4xr-00080F-Gt for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Nov 2024 00:27:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tG4xV-0002rO-Iz; Tue, 26 Nov 2024 18:27:05 -0500 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 1tG4xU-0002rD-0K for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 18:27:04 -0500 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 1tG4xT-0000jE-NX for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 18:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=pJbwPtyrEAA9WP6KXbWe9QWoWgfBMsRlbewZeX+Du1g=; b=p1ACaq3lrW5487fxd0CCf8F1YJD3sYxn4aANva+XN0zp2tgwEGqW/tdlwdMREisGcKog0kelZB2VVDBKZD57fiINSZoqflP7ofAFLjqCfT7oU6uoMGRPb8ex0Y12d7MrxyBrbxQ6GuNxvG6640PSX3ns3WlL2qAeFDEw6fa8+NP/OUDDHikBFLVVDY3XH8Kc5lVTFHbgmibchPdolHU0EvnqFq9dgX2Yy0bWU4Sf/2iwroSNwctcZva5J88IQAIpq9lNHv9q2n+IE2SHNh2NEWb5WhFyacWWcg9a/WgUlyUBSTpunpme5gzsE01pZ9nh7C94v08ZqWqB0jW6ApnhUg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tG4xS-0007fW-IE for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 18:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2024 23:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74243 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74243-submit@debbugs.gnu.org id=B74243.173266360029443 (code B ref 74243); Tue, 26 Nov 2024 23:27:02 +0000 Original-Received: (at 74243) by debbugs.gnu.org; 26 Nov 2024 23:26:40 +0000 Original-Received: from localhost ([127.0.0.1]:55424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tG4x5-0007ep-SO for submit@debbugs.gnu.org; Tue, 26 Nov 2024 18:26:40 -0500 Original-Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]:57031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tG4x3-0007eX-7H for 74243@debbugs.gnu.org; Tue, 26 Nov 2024 18:26:38 -0500 Original-Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 69879114016B; Tue, 26 Nov 2024 18:26:31 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Tue, 26 Nov 2024 18:26:31 -0500 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:subject:subject:to:to; s=fm2; t=1732663591; x=1732749991; bh=pJbwPtyrEAA9WP6KXbWe9QWoWgfBMsRlbewZeX+Du1g=; b= N3lOPIit11/4KdO4QzOUOqzUsT1O3UiKJ8qtfWMOB8IoVdzDJav+tI3iI9NzO7Fh xnO+tZC9/RaEpgyznVGCxlzWkXzxqle6TZVSCf+iZMYXeECErM0uVFKy/Ewp05nl jYqfih78n+ec057G8zBLSXhoEfronKW0RwW+uISF41fR2v1ERjieF8y1EukOm0VI wo2gOUNv4o2fcVlpMdMHsvBtO1AZBtsTKfkFUiqf7QhhxYmPoChJVbJjAjTshq+Y SjZk0Ij5D3Inh73MFXHAGuDin++90qeJ6MZtrurY5fPpu5lIg2Zzo0huonvqThLM nDypcYUMfDpXGtN8X5/Prw== 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:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1732663591; x= 1732749991; bh=pJbwPtyrEAA9WP6KXbWe9QWoWgfBMsRlbewZeX+Du1g=; b=s kVXvA+ya+e8dehtleD0ij/z472WKeMZuh26TZ9OZ/DpDaAzlJiheUhMpI25TdCsp Jyc21VxpUYyCWyWebuRbF57Dh++nOlU7D1/FHtL3WD/8dI4fxtMoQ9a95TstSUxq cfjghWVrfsFMyqDMhRIDqr2Bo3lv9M592xnAsuwzrI2Eyezn/3HNmTcRDtP3XuP7 3DHMAzqPmq3mAcTxuQmxFxvy0O68E7yzMxAbLDe+QSuVKtYohMcKexcYrQCent6n An+TcgLtvYuRPE65kMA0wR2j00t3wTEz5pYsiX0ZgYcW65CSIfXK0ZVMcF3rh9V1 GmQfJBSR8xLyHGnJeqr2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrgeekgddutdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeen ucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvg hvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedt vddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohep fedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshhpfihhihhtthhonhesshhpfi hhihhtthhonhdrnhgrmhgvpdhrtghpthhtohepshgsrghughhhsehjrghnvghsthhrvggv thdrtghomhdprhgtphhtthhopeejgedvgeefseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Nov 2024 18:26:28 -0500 (EST) Content-Language: en-US In-Reply-To: <87r06ytosi.fsf@melete.silentflame.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:296006 Archived-At: Hi, just to interject a little. On 26/11/2024 09:52, Sean Whitton wrote: > (I think there's a mistake here: an ignored file is not a file "under > version control", so `unregistered' should say "not under version > control and not ignored". Would you agree?) > > Thanks for pointing out the involvement of find-file-hook and > after-save-hook. The problem you describe is not at all Hg-specific: > vc-state gets called in a context where speed matters, but it's also the > primary entry point for any code that wants to know the state of a file, > some of which might care more about accuracy than speed. > > To put it another way, the code assumes throughout that finding out the > file state will always be fast. But it also assumes the information is > accurate if present. This makes me queasy about your original patch. > It does not seem wise to return something we don't know to be true only > on the basis that it all works out fine for now. This FR reminds me of a similar change in vc-git-state that we ended up installing in bug#11757 (in 2012). Then stayed with it until 2017 when bug#19343 was filed and fixed (provided a recent enough Git is used) - see also the problem scenario described there. So it seems both a reasonable change and ultimately not ideal. Depending on how many users we think might be affected by performance here. > The 'nil' return value might provide us with a way out, however. > Could we add an optional argument to vc-state that means "just return > nil if finding out the state properly might be slow"? > Could we make vc-after-save and the relevant find-file-hook entry pass > that option through, and do something sensible with a nil return value? > > If they get nil, they would clear out the saved property, and possibly > update the mode line display to "????" or something. Maybe we'd want a > user option (that could go in your large repo's .dir-locals.el, so it's > set-and-forget) to opt-in to not knowing the file state as often. A user option seems like an easier choice. Solutions that clear cache under some conditions or other tend to be more complex, and slow down at least some combined scenarios (e.g. one of my use cases is saving the buffer and having diff-hl-mode use its vc state from after-save-hook).