From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74243: [PATCH] Speed up vc-hg-state by treating ignored files as unregistered Date: Thu, 07 Nov 2024 12:41:47 -0500 Message-ID: Reply-To: Spencer Baugh Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11594"; mail-complaints-to="usenet@ciao.gmane.io" To: 74243@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 07 18:42:10 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 1t96WH-0002s0-RM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Nov 2024 18:42:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t96WB-0007ti-Tr; Thu, 07 Nov 2024 12:42:03 -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 1t96WA-0007tR-A9 for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 12:42:02 -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 1t96WA-0007yB-1e for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 12:42:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=YFBJsBgwQ4T17T5yuqnoE9hwEI6OSA+mL5af/Oefc8c=; b=MTB6Golji1eC9Q8ynaPrKS+zrO67HEsn402l1oK6Bp9Rx9LwLLG3/zB7Yz9gi42iToFT8zdvp0B9mtZ7UtSlW8CkfpoPC3NV2SJnZZH1SxBtSF0QO4omATCsTKj7o8Tv2/uxo6TrY6FccB2qFzKIt8X3VAZ4duru4YTqbf8TIVs/EQhaJPBryz/JQVgXTF9y5XVZeYL8ERvoZby38AcWh+eBHp0Np/UdxCjo2qKarBU4NRH5gmznshM/WElrVBCiNtjftdXUbUBSBEtI9MC/zH4kbv7MGUd16GEksyVYgWawxExkMrsdsnbHTCpJPlQT1a4szUYSarSXS+LDrMYxEA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t96W9-0002ng-Sb for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 12:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Nov 2024 17:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74243 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173100131810750 (code B ref -1); Thu, 07 Nov 2024 17:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Nov 2024 17:41:58 +0000 Original-Received: from localhost ([127.0.0.1]:49479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t96W5-0002nH-US for submit@debbugs.gnu.org; Thu, 07 Nov 2024 12:41:58 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t96W2-0002n7-6C for submit@debbugs.gnu.org; Thu, 07 Nov 2024 12:41:56 -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 1t96W1-0007t5-D1 for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 12:41:54 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t96Vz-0007wb-90 for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 12:41:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1731001307; bh=YFBJsBgwQ4T17T5yuqnoE9hwEI6OSA+mL5af/Oefc8c=; h=From:To:Subject:Date; b=w7R4QHoVrTI44tChExdx9yW0Wlu39llocSLQJZ9BzadrUOycn6P/Mf/0gYwnb0fZl molvE1LyvBI4Vjva6+ToY8kMjNd1ZoPkGUzSQbHCs1+47Pf5uNx6pG0+3gnZuDYMSO GNAYrdEHV7k6fL/K6i9qSHFvwBegDiUmpHh3M/NybQD93H+MQaiT/GPZc3RoOutAGx mwgIJ04fTYAXHzh08qb7DBG5d5+WRO77LYOaq33Iz9+xB1bjWWhXZjJIDGjpcnPJ43 5hwsRf3Bcf7qotYohb8fXge8ZM3L50nkJbn154DIcY7tOgnzUwhrqHqNSbJOFMYWEi ThjJgqTIFrcLg== Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:295037 Archived-At: --=-=-= Content-Type: text/plain Tags: patch The most significant slow component of "hg status" is parsing the .hgignore file. If we pass -mardc instead of -A to hg status, hg doesn't list ignored or untracked files, so it skips parsing the .hgignore. On my large repo, this brings "hg status" from 140ms to 20ms. For vc-hg-state, the distinction doesn't matter: nothing using the output of vc-hg-state has significantly different behavior for ignored files vs unregistered files: - vc-dir-clean-files and vc-dir-recompute-file-state call vc-hg-state, but will never see an ignored file anyway since vc-dir shouldn't list ignored files for hg. - vc-next-action checks 'ignored, but it's OK to take the 'unregistered path instead; it will either fail when calling hg, or succeed. - Other users of vc-state don't differ between 'ignored and 'unregistered * lisp/vc/vc-hg.el (vc-hg-state-slow): Treat ignored files as unregistered. In GNU Emacs 29.2.50 (build 6, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2024-11-06 built on igm-qws-u22796a Repository revision: 18ed746717c1c80e5cc9d9dc85b6e1f4013a1cec Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.10 (Green Obsidian) Configured using: 'configure --with-x-toolkit=lucid --without-gpm --without-gconf --without-selinux --without-imagemagick --with-modules --with-gif=no --with-tree-sitter --with-native-compilation=aot PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Speed-up-vc-hg-state-by-treating-ignored-files-as-un.patch >From 591dd8d7d5e23fd03696f9a536d7f40e77ea2de4 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 7 Nov 2024 12:28:49 -0500 Subject: [PATCH] Speed up vc-hg-state by treating ignored files as unregistered The most significant slow component of "hg status" is parsing the .hgignore file. If we pass -mardc instead of -A to hg status, hg doesn't list ignored or untracked files, so it skips parsing the .hgignore. On my large repo, this brings "hg status" from 140ms to 20ms. For vc-hg-state, the distinction doesn't matter: nothing using the output of vc-hg-state has significantly different behavior for ignored files vs unregistered files: - vc-dir-clean-files and vc-dir-recompute-file-state call vc-hg-state, but will never see an ignored file anyway since vc-dir shouldn't list ignored files for hg. - vc-next-action checks 'ignored, but it's OK to take the 'unregistered path instead; it will either fail when calling hg, or succeed. - Other users of vc-state don't differ between 'ignored and 'unregistered * lisp/vc/vc-hg.el (vc-hg-state-slow): Treat ignored files as unregistered. --- lisp/vc/vc-hg.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 856bea66a6f..2dbd1285318 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -245,7 +245,7 @@ vc-hg-state-slow "--config" "ui.report_untrusted=0" "--config" "alias.status=status" "--config" "defaults.status=" - "status" "-A" (file-relative-name file))) + "status" "-mardc" (file-relative-name file))) ;; Some problem happened. E.g. We can't find an `hg' ;; executable. (error nil))))))) @@ -260,12 +260,12 @@ vc-hg-state-slow ((eq state ?=) 'up-to-date) ((eq state ?A) 'added) ((eq state ?M) 'edited) - ((eq state ?I) 'ignored) ((eq state ?R) 'removed) ((eq state ?!) 'missing) - ((eq state ??) 'unregistered) ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this. - (t 'up-to-date)))))) + ;; Ignored or untracked files don't show up; they're both + ;; treated as unregistered. + (t 'unregistered)))))) (defun vc-hg-working-revision (_file) "Hg-specific version of `vc-working-revision'." -- 2.39.3 --=-=-=--