From unknown Mon Jun 16 23:38:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#78697 <78697@debbugs.gnu.org> To: bug#78697 <78697@debbugs.gnu.org> Subject: Status: `treesit-major-mode-setup` causing substantial pause when finding a file Reply-To: bug#78697 <78697@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:38:56 +0000 retitle 78697 `treesit-major-mode-setup` causing substantial pause when fin= ding a file reassign 78697 emacs submitter 78697 alexis purslane severity 78697 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 04 21:28:28 2025 Received: (at submit) by debbugs.gnu.org; 5 Jun 2025 01:28:28 +0000 Received: from localhost ([127.0.0.1]:55667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uMzP9-0005aN-JH for submit@debbugs.gnu.org; Wed, 04 Jun 2025 21:28:28 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55988) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uMzP6-0005ZT-K7 for submit@debbugs.gnu.org; Wed, 04 Jun 2025 21:28:25 -0400 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 1uMzP0-0000De-Qn for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2025 21:28:18 -0400 Received: from mail-0201.mail-europe.com ([51.77.79.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMzOy-0006qr-2m for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2025 21:28:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1749086882; x=1749346082; bh=eopGuUExY2zEwJUmqELbw7ywST2eBn+GaSoxaTweQRI=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=NgLXBcSDqZaCamuNT7DkjUe3R9TMjHQibWGh+AgowBqQ9IiKzwjf8MJSwN8nadtGz XgpLyiMTv5GD3Y18dDrivd9tcTto6Z27kadxITqrJCd7zc02NBjR8jOKf0wqgTTH+R dHGc7H7/um6f0xCcEpno/UFjGTq5j1qXKme9YO9vR4oUUFFx3zntHZcrhVjOJb499M ctTTkW8aTsVjxYu8RamIXzQeGGgtMQuKykwo5JVlaVj63n883OmpW1DVjTsgtBRLdC VCIx0bPfmQYf6NF7PNFVnEQIm9IHmz2RGXLuNNDShEDATieIik7kJqmproUHb7pCfO rU5wpdqeMV7XA== Date: Thu, 05 Jun 2025 01:27:58 +0000 To: "bug-gnu-emacs@gnu.org" From: alexis purslane Subject: `treesit-major-mode-setup` causing substantial pause when finding a file Message-ID: Feedback-ID: 55030218:user:proton X-Pm-Message-ID: b3f4539efc80d45af8e8d0cca10437ff6aa1ee27 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="------0765cb9e52670e9923805493e76bd88198a672d2a6ec72490074221bbc9c001b"; charset=utf-8 Received-SPF: pass client-ip=51.77.79.158; envelope-from=alexispurslane@pm.me; helo=mail-0201.mail-europe.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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------0765cb9e52670e9923805493e76bd88198a672d2a6ec72490074221bbc9c001b Content-Type: multipart/mixed;boundary=---------------------3eabff0eb35e9f023754d49c58421791 -----------------------3eabff0eb35e9f023754d49c58421791 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;charset=utf-8 # Problem As the title says: `treesit-major-mode-setup` appears to be causing a subs= tantial pause when finding a file that involves tree sitter modes (that I = have installed). I'm unclear s to why. # Detailed Information ## System Apple Mac Studio M1 Max running macOS 15.5 Sequoia (`aarch64-apple-darwin2= 4.5.0`) (temporarily using it instead of my Linux machine for work reasons= ) ## Emacs I've tried a few variations of Emacs to root out the problem: ### emacs-plus@31 from Homebrew System Configuration Options: `--disable-dependency-tracking --disable-sil= ent-rules --enable-locallisppath=3D/opt/homebrew/share/emacs/site-lisp --i= nfodir=3D/opt/homebrew/Cellar/emacs-plus@31/31.0.50/share/info/emacs --pre= fix=3D/opt/homebrew/Cellar/emacs-plus@31/31.0.50 --with-native-compilation= =3Daot --with-xml2 --with-gnutls --without-compress-install --without-dbus= --without-imagemagick --with-modules --with-rsvg --with-webp --with-ns --= disable-ns-self-contained 'CFLAGS=3D-O2 -DFD_SETSIZE=3D10000 -DDARWIN_UNLI= MITED_SELECT'` System Configuration Features: `ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2= MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIF= F TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB` #### Issues: - Random freezes all the time - Substantial freezes when opening a file ### `feature/igc` emacs 31.0.50 from HEAD System Configuration Options: `--prefix=3D/usr/local --with-tree-sitter --= with-xwidgets --with-ns --with-native-compilation=3Daot --with-imagemagick= --without-compress-install --with-small-ja-dic --without-selinux --withou= t-gsettings CC=3Dclang 'CFLAGS=3D-O3 -march=3Dnative` System Configuration Features: `ACL GLIB GNUTLS IMAGEMAGICK LCMS2 LIBXML2 = MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOL= KIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB` #### Issues - Thanks to the experimental MPS garbage collector, the random intermediat= e pauses have gone away (although it's still odd they were there =E2=80=93= even without MPS my Emacs configuration doesn't pause randomly on Linux) - However, while shorter, the pauses upon opening a new file are the same. ### same as above but with `treesit-auto` disabled Profiling the previous two versions seemed to indicate that a function in = the `treesit-auto` package was to blame, so I disabled `treesit-auto-mode`= to see if that made a difference; it did not. However, it narrowed down t= he issue further: #### Issues - There is no undue pause when opening any other kind of file; only tree-s= itter enabled files are so slow. - Most time opening a file (38%) is spent within `treesit-major-mode-setup= `: ``` 112,106,431 95% - command-execute ... 84,918,927 72% - find-file 84,916,421 72% - find-file-noselect 84,902,072 72% - find-file-noselect-1 84,852,273 72% - after-find-file 84,735,710 72% - normal-mode 80,077,055 68% - set-auto-mode 79,933,703 68% - set-auto-mode--apply-alist 79,923,463 68% - set-auto-mode-0 79,923,463 68% - clojure-ts-clojurescript-mode 45,382,937 38% - clojure-ts-mode 45,305,561 38% + treesit-major-mode-setup 25,386 0% + treesit-ready-p 20,512 0% + clojure-ts-mode-variables 17,202 0% clojure-ts--ensure-grammars 8,288 0% + clojure-ts--compute-semantic-indentat= ion-rules-cache 34,540,526 29% + run-mode-hooks ... ``` The function `clojure-ts-clojurescript-mode` seems to add significant over= head as well, even though it appears to be a simple derived mode that does= n't even have any body forms. It didn't have any problem on Linux. I'm rather at a loss as to what's going on. = -----------------------3eabff0eb35e9f023754d49c58421791 Content-Type: application/pgp-keys; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4ak1FWXlPNktCWUpLd1lCQkFI YVJ3OEJBUWRBaW0wYXBzbTJaTmd1N1lYU3VDLzNUVjUvenhNZE1tWDMKazhUZllSUVlRaXZOSzJG c1pYaHBjM0IxY25Oc1lXNWxRSEJ0TG0xbElEeGhiR1Y0YVhOd2RYSnpiR0Z1ClpVQndiUzV0WlQ3 Q2pBUVFGZ29BSFFVQ1l5TzZLQVFMQ1FjSUF4VUlDZ1FXQUFJQkFoa0JBaHNEQWg0QgpBQ0VKRVBQ S1ZsRUw1OThSRmlFRVFlWVZhTDAydVRUczdkdzI4OHBXVVF2bjN4RlJ2Z0QrTUUzdEhXOFgKdGpt NXdqeU9zVzQ1NjIxSEpGUXdGZnVnbGZZczlkVU03YTRBLzNFeEppdFVMTk1mdy9DRlVIbVAyR21T Ckp1blE1cENNYzkyM1FYdytPZjBMempnRVl5TzZLQklLS3dZQkJBR1hWUUVGQVFFSFFBVHJrMXFN Q0FVVgpDMFRBeFAvV3B6QjY4MG5DVmNlK1E2OVNPUWR6Uk9VY0F3RUlCOEo0QkJnV0NBQUpCUUpq STdvb0Foc00KQUNFSkVQUEtWbEVMNTk4UkZpRUVRZVlWYUwwMnVUVHM3ZHcyODhwV1VRdm4zeEc5 VkFFQTlDV1Q5bHVuCldWZG5MWis0RlpySUZKZW9EUFAzTE9Jd09oRFVnY1ZtZU8wQS9qdHVjYjRk eERzVTFiRjNkVjlHbGszaQo1SDJZcnIvRTJBYVlMbWFOVVBvTgo9SzRRaQotLS0tLUVORCBQR1Ag UFVCTElDIEtFWSBCTE9DSy0tLS0tCg== -----------------------3eabff0eb35e9f023754d49c58421791-- --------0765cb9e52670e9923805493e76bd88198a672d2a6ec72490074221bbc9c001b Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wrsEARYKAG0FgmhA8o4JkPPKVlEL598RRRQAAAAAABwAIHNhbHRAbm90YXRp b25zLm9wZW5wZ3Bqcy5vcmcArfyH89xG5Yu5rdqqkNe7VW4CnW05SsoY75NT 1CHx1hYhBEHmFWi9Nrk07O3cNvPKVlEL598RAAAy9wEAxzMLwafWnkBXJkgl JUuFhKu7Z4E23yMGmTwByYX51mwA/16MkRhxi7misQqfxylA3IcdDIHcIDBj OJnosp0sx/UA =90dM -----END PGP SIGNATURE----- --------0765cb9e52670e9923805493e76bd88198a672d2a6ec72490074221bbc9c001b-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 05 05:09:44 2025 Received: (at 78697) by debbugs.gnu.org; 5 Jun 2025 09:09:44 +0000 Received: from localhost ([127.0.0.1]:58853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uN6bW-0006tD-Nu for submit@debbugs.gnu.org; Thu, 05 Jun 2025 05:09:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33572) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uN6bT-0006ry-6O for 78697@debbugs.gnu.org; Thu, 05 Jun 2025 05:09:40 -0400 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 1uN6bN-0006y6-QZ; Thu, 05 Jun 2025 05:09:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GH/C45vAMLLYg+PPIYxiSNT0Zx1RcHypC99cg8mz/RA=; b=oj+HDh3+thaZ nhEUkWo1hgZreYxL9Lv5Y+vWpZ6BkSVWhsW9eLc9ct4NzG2Z/h/mazWWb477VLzJu9syQ7p//7A6N Q3iUJPsd+Whe0KF498CE0hO8zfW/ceO4uKZrRVBRvupBP2GagkAEZRLDoZ7VtoXTpRbif6k21+aCO HjDWu6c19eLosceLU+OpprluE3wi9fwbWzjCL3vLvp022+H/2YSiDnskw0dT5CDQi1Pmp8LNbLNEu XU24YLGKar864sMoQoTN9SbmmBs+HyVkj+nBNRuOrJ7uucD1c2eccD9v3ThH7yG6w/aMGZ8eSXCND E36kadNKcfFvbirWaiDE1w==; Date: Thu, 05 Jun 2025 12:09:00 +0300 Message-Id: <86o6v2mu6r.fsf@gnu.org> From: Eli Zaretskii To: alexis purslane In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#78697: `treesit-major-mode-setup` causing substantial pause when finding a file References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78697 Cc: 78697@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 05 Jun 2025 01:27:58 +0000 > From: alexis purslane via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > - Most time opening a file (38%) is spent within `treesit-major-mode-setup`: > > ``` > 112,106,431 95% - command-execute > ... > 84,918,927 72% - find-file > 84,916,421 72% - find-file-noselect > 84,902,072 72% - find-file-noselect-1 > 84,852,273 72% - after-find-file > 84,735,710 72% - normal-mode > 80,077,055 68% - set-auto-mode > 79,933,703 68% - set-auto-mode--apply-alist > 79,923,463 68% - set-auto-mode-0 > 79,923,463 68% - clojure-ts-clojurescript-mode > 45,382,937 38% - clojure-ts-mode > 45,305,561 38% + treesit-major-mode-setup > 25,386 0% + treesit-ready-p > 20,512 0% + clojure-ts-mode-variables > 17,202 0% clojure-ts--ensure-grammars > 8,288 0% + clojure-ts--compute-semantic-indentation-rules-cache > 34,540,526 29% + run-mode-hooks > ... > ``` > > The function `clojure-ts-clojurescript-mode` seems to add significant overhead as well, even though it appears to be a simple derived mode that doesn't even have any body forms. It didn't have any problem on Linux. Please show the fully expanded profile, with all the levels marked with "+" expanded. As posted, the profile stops showing details at the most important function: treesit-major-mode-setup, so it is hard to come up with ideas what could be the problem. Also, since clojure-ts-mode is not part of Emacs, did you report this to the mode's developers? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 05 09:55:21 2025 Received: (at 78697) by debbugs.gnu.org; 5 Jun 2025 13:55:21 +0000 Received: from localhost ([127.0.0.1]:60952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNB3x-00033h-2U for submit@debbugs.gnu.org; Thu, 05 Jun 2025 09:55:21 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]:61387) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNB3t-0002ys-0x for 78697@debbugs.gnu.org; Thu, 05 Jun 2025 09:55:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1749131710; x=1749390910; bh=JDvYn4J0n1xzKGGf+1MqZtlMSYo/x+raOADBUk2V56o=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=NkLzjNRZlOd4+cnmPxd/S3htDGx31yglxtJ0KxA2uUk7S2RF9kH+xzxtSGWt0my8f tWr33gOTWD9E3n2QgGbA7xRZxlHFWyyQBehQIyXibg+EJsDVFZMAVKg1EV/W/IfZAO 38CoxYoEOOT2jxWHLxONlowaJ8TK6SG3g8CwtpAah/955x7K5rmkGYoOXvPNgOA7Xs IhvZ0XgF9AtezujLxn63TBNirMH04aYCYM0FeBSBIzvzxjxCeXqhLBXefGWrugZBAO s6XMqfW085Qtv7ZBHWXK/gCwsT5bk2ba45SBxBbGWvZDjj/JX/0yh3J5lnN59ALJRo oncWyvzzu25YQ== Date: Thu, 05 Jun 2025 13:55:05 +0000 To: Eli Zaretskii From: alexis purslane Subject: Re: bug#78697: `treesit-major-mode-setup` causing substantial pause when finding a file Message-ID: In-Reply-To: <86o6v2mu6r.fsf@gnu.org> References: <86o6v2mu6r.fsf@gnu.org> Feedback-ID: 55030218:user:proton X-Pm-Message-ID: 735e2af4f57546300987d2ea3c0f7ffc51577a5f MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="------bd66d4d8f41d212dfb1d86dc2da68b6cb69c2a9f37e2f16571c39e7c746ca404"; charset=utf-8 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78697 Cc: 78697@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------bd66d4d8f41d212dfb1d86dc2da68b6cb69c2a9f37e2f16571c39e7c746ca404 Content-Type: multipart/mixed;boundary=---------------------9d4923500a9f349d750df7232e144f33 -----------------------9d4923500a9f349d750df7232e144f33 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;charset=utf-8 I don't have the original profile anymore, but it was easy enough to repro= duce. Here's that reproduced version: 481 80% - command-execute 481 80% - funcall-interactively 481 80% - god-mode-self-insert 262 44% - funcall-interactively 261 43% - project-find-file 261 43% - project-find-file-in 205 34% - find-file 205 34% - find-file-noselect 202 34% - find-file-noselect-1 200 33% - after-find-file 195 32% - normal-mode 189 31% - set-auto-mode 188 31% - set-auto-mode--apply-alist 188 31% - set-auto-mode-0 188 31% - clojure-ts-clojurescript-mode 164 27% - clojure-ts-mode 114 19% - treesit-major-mode-setup 114 19% - treesit-validate-font-lock-rules 91 15% treesit-query-compile 23 3% clojure-ts--ensure-grammars 10 1% + treesit-ready-p 1 0% + clojure-ts-mode-variables 24 4% + run-mode-hooks 1 0% + hack-dir-local--get-variables 6 1% + font-lock-mode 5 0% + run-hooks 2 0% insert-file-contents 1 0% abbreviate-file-name 1 0% + file-truename 1 0% + find-buffer-visiting 52 8% + project--read-file-name 4 0% + project-files 1 0% + execute-extended-command 122 20% - god-mode-lookup-key-sequence 85 14% - god-mode-lookup-command 85 14% - apply 85 14% - which-key--god-mode-lookup-command-advice 85 14% + # 37 6% + god-key-string-after-consuming-key 97 16% + byte-code 91 15% redisplay_internal (C function) 11 1% + ... 10 1% + timer-event-handler 1 0% + which-key--hide-popup Also, I didn't original report this to the clojurescript-ts-mode folks bec= ause (1) since this branched into built-in functions it seemed like an ema= cs problem, and compoundingly (2) in one of the earlier iterations of my t= esting I was seeing this performance issue across all files that would loa= d tree-sitter modes; however, I just did another couple tests and profiles= with rust, bash, and TSX and didn't see it anymore, so I'll go poke them = about it now because it does seem like more of their problem. On Thursday, June 5th, 2025 at 9:09 AM, Eli Zaretskii wrote= : > > Date: Thu, 05 Jun 2025 01:27:58 +0000 > > From: alexis purslane via "Bug reports for GNU Emacs, > > the Swiss army knife of text editors" bug-gnu-emacs@gnu.org > > = > > - Most time opening a file (38%) is spent within `treesit-major-mode-s= etup`: > > = > > `112,106,431 95% - command-execute ... 84,918,927 72% - find-file 84,9= 16,421 72% - find-file-noselect 84,902,072 72% - find-file-noselect-1 84,8= 52,273 72% - after-find-file 84,735,710 72% - normal-mode 80,077,055 68% -= set-auto-mode 79,933,703 68% - set-auto-mode--apply-alist 79,923,463 68% = - set-auto-mode-0 79,923,463 68% - clojure-ts-clojurescript-mode 45,382,93= 7 38% - clojure-ts-mode 45,305,561 38% + treesit-major-mode-setup 25,386 0= % + treesit-ready-p 20,512 0% + clojure-ts-mode-variables 17,202 0% clojur= e-ts--ensure-grammars 8,288 0% + clojure-ts--compute-semantic-indentation-= rules-cache 34,540,526 29% + run-mode-hooks ...` > > = > > The function `clojure-ts-clojurescript-mode` seems to add significant = overhead as well, even though it appears to be a simple derived mode that = doesn't even have any body forms. It didn't have any problem on Linux. > = > = > Please show the fully expanded profile, with all the levels marked > with "+" expanded. As posted, the profile stops showing details at > the most important function: treesit-major-mode-setup, so it is hard > to come up with ideas what could be the problem. > = > Also, since clojure-ts-mode is not part of Emacs, did you report this > to the mode's developers? > = > Thanks. -----------------------9d4923500a9f349d750df7232e144f33 Content-Type: application/pgp-keys; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4ak1FWXlPNktCWUpLd1lCQkFI YVJ3OEJBUWRBaW0wYXBzbTJaTmd1N1lYU3VDLzNUVjUvenhNZE1tWDMKazhUZllSUVlRaXZOSzJG c1pYaHBjM0IxY25Oc1lXNWxRSEJ0TG0xbElEeGhiR1Y0YVhOd2RYSnpiR0Z1ClpVQndiUzV0WlQ3 Q2pBUVFGZ29BSFFVQ1l5TzZLQVFMQ1FjSUF4VUlDZ1FXQUFJQkFoa0JBaHNEQWg0QgpBQ0VKRVBQ S1ZsRUw1OThSRmlFRVFlWVZhTDAydVRUczdkdzI4OHBXVVF2bjN4RlJ2Z0QrTUUzdEhXOFgKdGpt NXdqeU9zVzQ1NjIxSEpGUXdGZnVnbGZZczlkVU03YTRBLzNFeEppdFVMTk1mdy9DRlVIbVAyR21T Ckp1blE1cENNYzkyM1FYdytPZjBMempnRVl5TzZLQklLS3dZQkJBR1hWUUVGQVFFSFFBVHJrMXFN Q0FVVgpDMFRBeFAvV3B6QjY4MG5DVmNlK1E2OVNPUWR6Uk9VY0F3RUlCOEo0QkJnV0NBQUpCUUpq STdvb0Foc00KQUNFSkVQUEtWbEVMNTk4UkZpRUVRZVlWYUwwMnVUVHM3ZHcyODhwV1VRdm4zeEc5 VkFFQTlDV1Q5bHVuCldWZG5MWis0RlpySUZKZW9EUFAzTE9Jd09oRFVnY1ZtZU8wQS9qdHVjYjRk eERzVTFiRjNkVjlHbGszaQo1SDJZcnIvRTJBYVlMbWFOVVBvTgo9SzRRaQotLS0tLUVORCBQR1Ag UFVCTElDIEtFWSBCTE9DSy0tLS0tCg== -----------------------9d4923500a9f349d750df7232e144f33-- --------bd66d4d8f41d212dfb1d86dc2da68b6cb69c2a9f37e2f16571c39e7c746ca404 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wrsEARYKAG0FgmhBoakJkPPKVlEL598RRRQAAAAAABwAIHNhbHRAbm90YXRp b25zLm9wZW5wZ3Bqcy5vcmdZ4tmSMn4wLGLwwdWRWIT6YDtQN+hUIGat93rP Nw/eHBYhBEHmFWi9Nrk07O3cNvPKVlEL598RAACdWgEA1L1hGMXs5LEOLmlv v2fxlGPTU+r0oMHhawIw6I2YbeIA/13Xs4Gl2CYVF68b707u0mvSonQdFglZ QFquwggaUDAN =FU28 -----END PGP SIGNATURE----- --------bd66d4d8f41d212dfb1d86dc2da68b6cb69c2a9f37e2f16571c39e7c746ca404-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 05 10:03:30 2025 Received: (at 78697) by debbugs.gnu.org; 5 Jun 2025 14:03:30 +0000 Received: from localhost ([127.0.0.1]:34755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNBBp-00046s-KM for submit@debbugs.gnu.org; Thu, 05 Jun 2025 10:03:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58814) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNBBl-00046C-4K for 78697@debbugs.gnu.org; Thu, 05 Jun 2025 10:03:26 -0400 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 1uNBBf-00069L-MN; Thu, 05 Jun 2025 10:03:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mrDP93t9NTDqB0fuYjWkWN6YTvAFDRHZWD2grz9R/Es=; b=JT3mADc4zI2K RhlJ1M8u4R3pTBrhrNcdKiwIUdQyaaRX+8+Hcji1WT5NkHsAY1PQrZkzJnNPAaP/YrkmiHkQyKihw 9C0oXE3QfnzJjVD6VmfiHkPJTgTcGJGvLGqhCgSxzrzW6YjVYsnwg6LrWGK1TRphPKLpudSttNxCv XZL8PoTtD0tJ/4bwRBXgdwFEOB8kXJzF3LlT/bqxinHBjvg+tt2Jjwv/ivmfMIY4cGC3f8Y4NUC6X voHcefqvHp7v6bpvbppr1D4IN3kZ6Ck91cuw72GrNMQ41KQUlYhDF03HvTtl/ggqCV9G5pILB8qMM 8/VtdcF/+zjxcG+hxMqEuQ==; Date: Thu, 05 Jun 2025 17:03:10 +0300 Message-Id: <86iklamgkh.fsf@gnu.org> From: Eli Zaretskii To: alexis purslane In-Reply-To: (message from alexis purslane on Thu, 05 Jun 2025 13:55:05 +0000) Subject: Re: bug#78697: `treesit-major-mode-setup` causing substantial pause when finding a file References: <86o6v2mu6r.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78697 Cc: 78697@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 05 Jun 2025 13:55:05 +0000 > From: alexis purslane > Cc: 78697@debbugs.gnu.org > > I don't have the original profile anymore, but it was easy enough to reproduce. Here's that reproduced version: > > 481 80% - command-execute > 481 80% - funcall-interactively > 481 80% - god-mode-self-insert > 262 44% - funcall-interactively > 261 43% - project-find-file > 261 43% - project-find-file-in > 205 34% - find-file > 205 34% - find-file-noselect > 202 34% - find-file-noselect-1 > 200 33% - after-find-file > 195 32% - normal-mode > 189 31% - set-auto-mode > 188 31% - set-auto-mode--apply-alist > 188 31% - set-auto-mode-0 > 188 31% - clojure-ts-clojurescript-mode > 164 27% - clojure-ts-mode > 114 19% - treesit-major-mode-setup > 114 19% - treesit-validate-font-lock-rules > 91 15% treesit-query-compile > 23 3% clojure-ts--ensure-grammars > 10 1% + treesit-ready-p > 1 0% + clojure-ts-mode-variables > 24 4% + run-mode-hooks > 1 0% + hack-dir-local--get-variables > 6 1% + font-lock-mode > 5 0% + run-hooks > 2 0% insert-file-contents > 1 0% abbreviate-file-name > 1 0% + file-truename > 1 0% + find-buffer-visiting > 52 8% + project--read-file-name > 4 0% + project-files > 1 0% + execute-extended-command > 122 20% - god-mode-lookup-key-sequence > 85 14% - god-mode-lookup-command > 85 14% - apply > 85 14% - which-key--god-mode-lookup-command-advice > 85 14% + # > 37 6% + god-key-string-after-consuming-key > 97 16% + byte-code > 91 15% redisplay_internal (C function) > 11 1% + ... > 10 1% + timer-event-handler > 1 0% + which-key--hide-popup Thanks, this seem to say that a large portion of time is spent inside treesit-query-compile. > Also, I didn't original report this to the clojurescript-ts-mode folks because (1) since this branched into built-in functions it seemed like an emacs problem, and compoundingly (2) in one of the earlier iterations of my testing I was seeing this performance issue across all files that would load tree-sitter modes; however, I just did another couple tests and profiles with rust, bash, and TSX and didn't see it anymore, so I'll go poke them about it now because it does seem like more of their problem. It is quite possible that clojure-ts-clojurescript-mode defines some mode-specific data that makes treesit-query-compile do some heavy lifting. So I think you should report this to the mode developers. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 05 10:05:11 2025 Received: (at 78697) by debbugs.gnu.org; 5 Jun 2025 14:05:11 +0000 Received: from localhost ([127.0.0.1]:34775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNBDT-0004GN-2W for submit@debbugs.gnu.org; Thu, 05 Jun 2025 10:05:11 -0400 Received: from mail-24416.protonmail.ch ([109.224.244.16]:27187) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNBDP-0004BX-Nv for 78697@debbugs.gnu.org; Thu, 05 Jun 2025 10:05:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1749132300; x=1749391500; bh=lJ5EFOl0N4vDaMty5Ni7CwV4PJSMHGqXhgx2RIyd/QM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=Uc3FwJIv5Ntdg5caCtPHoIdENp6Shd8geuqAyVi9gAe3QXcA7XbVxu9CugZbnUrmf suzsIjuoCMiPn+VbROEaP9DGnsYrLsBN93+Up4eueRlloZdrz/ib61CsWXTzS2Qbjm PZtZKd+cwh7kQ+emRwWiJVr4dcDKdtuPVJMEekwm+0yXYE6wjqoG0UbdVz24/WpF+X 892V9qtNLOwaSrrrxDfV2M6qzajecXS3vMLvTg5/4C3GsuDUA+w5vyeuP/wu6z0KXP 9xLA+u3qebfm7PJuT1CraTWYSbwxglUbXHMiZLkTEJi9LRut4Byjf4PMEaz/Iz66e3 FOGaJEv8k5FcA== Date: Thu, 05 Jun 2025 14:04:56 +0000 To: Eli Zaretskii From: alexis purslane Subject: Re: bug#78697: `treesit-major-mode-setup` causing substantial pause when finding a file Message-ID: <8b8QiisykK8V-DqgrDxD1kL3X8KBbsUubFmZ2r4_F_1_xg5XlxWotm-5tXrxftxuySaQzylILuKTk0SF1iQdAv6xOhGrDLPKU384kYp1_mM=@pm.me> In-Reply-To: <86iklamgkh.fsf@gnu.org> References: <86o6v2mu6r.fsf@gnu.org> <86iklamgkh.fsf@gnu.org> Feedback-ID: 55030218:user:proton X-Pm-Message-ID: d3257b95319f6eb06da85a3f20167c15e34e22f6 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="------95d7bb48f3c12f6c49ce3f13451cb415ff27ba9b642f257cfe0391043f8fc52b"; charset=utf-8 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78697 Cc: 78697@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------95d7bb48f3c12f6c49ce3f13451cb415ff27ba9b642f257cfe0391043f8fc52b Content-Type: multipart/mixed;boundary=---------------------d32c6252ed6d42ab7b6a6ffa24083ebf -----------------------d32c6252ed6d42ab7b6a6ffa24083ebf Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;charset=utf-8 Yeah, looking at the new profiles made me realize that too, so I submitted= it before responding. In case you want to follow the issue: https://githu= b.com/clojure-emacs/clojure-ts-mode/issues/109 On Thursday, June 5th, 2025 at 2:03 PM, Eli Zaretskii wrote= : > > Date: Thu, 05 Jun 2025 13:55:05 +0000 > > From: alexis purslane alexispurslane@pm.me > > Cc: 78697@debbugs.gnu.org > > = > > I don't have the original profile anymore, but it was easy enough to r= eproduce. Here's that reproduced version: > > = > > 481 80% - command-execute > > 481 80% - funcall-interactively > > 481 80% - god-mode-self-insert > > 262 44% - funcall-interactively > > 261 43% - project-find-file > > 261 43% - project-find-file-in > > 205 34% - find-file > > 205 34% - find-file-noselect > > 202 34% - find-file-noselect-1 > > 200 33% - after-find-file > > 195 32% - normal-mode > > 189 31% - set-auto-mode > > 188 31% - set-auto-mode--apply-alist > > 188 31% - set-auto-mode-0 > > 188 31% - clojure-ts-clojurescript-mode > > 164 27% - clojure-ts-mode > > 114 19% - treesit-major-mode-setup > > 114 19% - treesit-validate-font-lock-rules > > 91 15% treesit-query-compile > > 23 3% clojure-ts--ensure-grammars > > 10 1% + treesit-ready-p > > 1 0% + clojure-ts-mode-variables > > 24 4% + run-mode-hooks > > 1 0% + hack-dir-local--get-variables > > 6 1% + font-lock-mode > > 5 0% + run-hooks > > 2 0% insert-file-contents > > 1 0% abbreviate-file-name > > 1 0% + file-truename > > 1 0% + find-buffer-visiting > > 52 8% + project--read-file-name > > 4 0% + project-files > > 1 0% + execute-extended-command > > 122 20% - god-mode-lookup-key-sequence > > 85 14% - god-mode-lookup-command > > 85 14% - apply > > 85 14% - which-key--god-mode-lookup-command-advice > > 85 14% + # > > 37 6% + god-key-string-after-consuming-key > > 97 16% + byte-code > > 91 15% redisplay_internal (C function) > > 11 1% + ... > > 10 1% + timer-event-handler > > 1 0% + which-key--hide-popup > = > = > Thanks, this seem to say that a large portion of time is spent inside > treesit-query-compile. > = > > Also, I didn't original report this to the clojurescript-ts-mode folks= because (1) since this branched into built-in functions it seemed like an= emacs problem, and compoundingly (2) in one of the earlier iterations of = my testing I was seeing this performance issue across all files that would= load tree-sitter modes; however, I just did another couple tests and prof= iles with rust, bash, and TSX and didn't see it anymore, so I'll go poke t= hem about it now because it does seem like more of their problem. > = > = > It is quite possible that clojure-ts-clojurescript-mode defines some > mode-specific data that makes treesit-query-compile do some heavy > lifting. So I think you should report this to the mode developers. -----------------------d32c6252ed6d42ab7b6a6ffa24083ebf Content-Type: application/pgp-keys; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4ak1FWXlPNktCWUpLd1lCQkFI YVJ3OEJBUWRBaW0wYXBzbTJaTmd1N1lYU3VDLzNUVjUvenhNZE1tWDMKazhUZllSUVlRaXZOSzJG c1pYaHBjM0IxY25Oc1lXNWxRSEJ0TG0xbElEeGhiR1Y0YVhOd2RYSnpiR0Z1ClpVQndiUzV0WlQ3 Q2pBUVFGZ29BSFFVQ1l5TzZLQVFMQ1FjSUF4VUlDZ1FXQUFJQkFoa0JBaHNEQWg0QgpBQ0VKRVBQ S1ZsRUw1OThSRmlFRVFlWVZhTDAydVRUczdkdzI4OHBXVVF2bjN4RlJ2Z0QrTUUzdEhXOFgKdGpt NXdqeU9zVzQ1NjIxSEpGUXdGZnVnbGZZczlkVU03YTRBLzNFeEppdFVMTk1mdy9DRlVIbVAyR21T Ckp1blE1cENNYzkyM1FYdytPZjBMempnRVl5TzZLQklLS3dZQkJBR1hWUUVGQVFFSFFBVHJrMXFN Q0FVVgpDMFRBeFAvV3B6QjY4MG5DVmNlK1E2OVNPUWR6Uk9VY0F3RUlCOEo0QkJnV0NBQUpCUUpq STdvb0Foc00KQUNFSkVQUEtWbEVMNTk4UkZpRUVRZVlWYUwwMnVUVHM3ZHcyODhwV1VRdm4zeEc5 VkFFQTlDV1Q5bHVuCldWZG5MWis0RlpySUZKZW9EUFAzTE9Jd09oRFVnY1ZtZU8wQS9qdHVjYjRk eERzVTFiRjNkVjlHbGszaQo1SDJZcnIvRTJBYVlMbWFOVVBvTgo9SzRRaQotLS0tLUVORCBQR1Ag UFVCTElDIEtFWSBCTE9DSy0tLS0tCg== -----------------------d32c6252ed6d42ab7b6a6ffa24083ebf-- --------95d7bb48f3c12f6c49ce3f13451cb415ff27ba9b642f257cfe0391043f8fc52b Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wrsEARYKAG0FgmhBo/kJkPPKVlEL598RRRQAAAAAABwAIHNhbHRAbm90YXRp b25zLm9wZW5wZ3Bqcy5vcmd2PKyDpOnGvs9WycknZP/xdxsEv216pM2PBu4z hxNedRYhBEHmFWi9Nrk07O3cNvPKVlEL598RAAC1mQEAkMgc5eaQmox7L6Kr 6BgDDeE0kYtN9sAJPz3/1Cn84aoA/jtKW2NxzMMzTImHYSbbPaVw6LMGILKW LLTS8u7Ydl8E =xoXh -----END PGP SIGNATURE----- --------95d7bb48f3c12f6c49ce3f13451cb415ff27ba9b642f257cfe0391043f8fc52b-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 05 11:02:11 2025 Received: (at 78697) by debbugs.gnu.org; 5 Jun 2025 15:02:12 +0000 Received: from localhost ([127.0.0.1]:35213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNC6a-0000Z7-DP for submit@debbugs.gnu.org; Thu, 05 Jun 2025 11:02:11 -0400 Received: from mail-24417.protonmail.ch ([109.224.244.17]:34739) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNC6R-0000Wv-GB for 78697@debbugs.gnu.org; Thu, 05 Jun 2025 11:02:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1749135712; x=1749394912; bh=buCmp+IlBPZzA3OwrdGYikQyABj7MVZ3z8H6ucyFcdQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=Py6vWZyzVZ/makYwNJB85Phr2TtW3KWOJE8QHtyb8dZC9aaeWs8vRNWW3AlD86okN OG0FkGJEmhsz4O4bUIPK5bKSReRzGPuQ0ADm3emG5byHLImV//6yt34FiPY8SqbOoL y+Tthlh+fWfNr4rvmU8+m/UJwQAT1LeDael3OQlrSgjKI00aU6UEoDzJJb+JMLCiOk Mb2me5y3NbZk6lCAWpDRzEjzc0it11MWivDdx6Yu8WrszYhc15euqo5mOt/ZdiTvwU 29yhRmjYidWIfjU3pvZxzvURmhxsOrgUluhPbYDdDHSOKWcXdHmY+lV2qnubmLyMud fxYEdyCDkoj9g== Date: Thu, 05 Jun 2025 15:01:48 +0000 To: Eli Zaretskii From: alexis purslane Subject: Re: bug#78697: `treesit-major-mode-setup` causing substantial pause when finding a file Message-ID: In-Reply-To: <8b8QiisykK8V-DqgrDxD1kL3X8KBbsUubFmZ2r4_F_1_xg5XlxWotm-5tXrxftxuySaQzylILuKTk0SF1iQdAv6xOhGrDLPKU384kYp1_mM=@pm.me> References: <86o6v2mu6r.fsf@gnu.org> <86iklamgkh.fsf@gnu.org> <8b8QiisykK8V-DqgrDxD1kL3X8KBbsUubFmZ2r4_F_1_xg5XlxWotm-5tXrxftxuySaQzylILuKTk0SF1iQdAv6xOhGrDLPKU384kYp1_mM=@pm.me> Feedback-ID: 55030218:user:proton X-Pm-Message-ID: ee49477c6bdfb1c9ee31fd4fdf52fa78dc1eaaaa MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="------fcd25f0fb5c12fc4ede9171fc1ad0de2f0273a3a799661943986adfeb55b18f5"; charset=utf-8 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78697 Cc: 78697@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------fcd25f0fb5c12fc4ede9171fc1ad0de2f0273a3a799661943986adfeb55b18f5 Content-Type: multipart/mixed;boundary=---------------------c3a4e1a0b4d8e37db96552f8902a580a -----------------------c3a4e1a0b4d8e37db96552f8902a580a Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;charset=utf-8 Oh, I did want to mention that while on Linux I didn't notice much of an i= mprovement using MPS, on Mac OS, going from regular Emacs to the feature/i= gc branch eliminated a huge amount of very long and constant random pauses= and made it much, much faster. And I haven't run into any bugs or issues = with it still. On Thursday, June 5th, 2025 at 2:04 PM, alexis purslane wrote: > Yeah, looking at the new profiles made me realize that too, so I submitt= ed it before responding. In case you want to follow the issue: https://git= hub.com/clojure-emacs/clojure-ts-mode/issues/109 > = > On Thursday, June 5th, 2025 at 2:03 PM, Eli Zaretskii eliz@gnu.org wrote= : > = > > > Date: Thu, 05 Jun 2025 13:55:05 +0000 > > > From: alexis purslane alexispurslane@pm.me > > > Cc: 78697@debbugs.gnu.org > > > = > > > I don't have the original profile anymore, but it was easy enough to= reproduce. Here's that reproduced version: > > > = > > > 481 80% - command-execute > > > 481 80% - funcall-interactively > > > 481 80% - god-mode-self-insert > > > 262 44% - funcall-interactively > > > 261 43% - project-find-file > > > 261 43% - project-find-file-in > > > 205 34% - find-file > > > 205 34% - find-file-noselect > > > 202 34% - find-file-noselect-1 > > > 200 33% - after-find-file > > > 195 32% - normal-mode > > > 189 31% - set-auto-mode > > > 188 31% - set-auto-mode--apply-alist > > > 188 31% - set-auto-mode-0 > > > 188 31% - clojure-ts-clojurescript-mode > > > 164 27% - clojure-ts-mode > > > 114 19% - treesit-major-mode-setup > > > 114 19% - treesit-validate-font-lock-rules > > > 91 15% treesit-query-compile > > > 23 3% clojure-ts--ensure-grammars > > > 10 1% + treesit-ready-p > > > 1 0% + clojure-ts-mode-variables > > > 24 4% + run-mode-hooks > > > 1 0% + hack-dir-local--get-variables > > > 6 1% + font-lock-mode > > > 5 0% + run-hooks > > > 2 0% insert-file-contents > > > 1 0% abbreviate-file-name > > > 1 0% + file-truename > > > 1 0% + find-buffer-visiting > > > 52 8% + project--read-file-name > > > 4 0% + project-files > > > 1 0% + execute-extended-command > > > 122 20% - god-mode-lookup-key-sequence > > > 85 14% - god-mode-lookup-command > > > 85 14% - apply > > > 85 14% - which-key--god-mode-lookup-command-advice > > > 85 14% + # > > > 37 6% + god-key-string-after-consuming-key > > > 97 16% + byte-code > > > 91 15% redisplay_internal (C function) > > > 11 1% + ... > > > 10 1% + timer-event-handler > > > 1 0% + which-key--hide-popup > > = > > Thanks, this seem to say that a large portion of time is spent inside > > treesit-query-compile. > > = > > > Also, I didn't original report this to the clojurescript-ts-mode fol= ks because (1) since this branched into built-in functions it seemed like = an emacs problem, and compoundingly (2) in one of the earlier iterations o= f my testing I was seeing this performance issue across all files that wou= ld load tree-sitter modes; however, I just did another couple tests and pr= ofiles with rust, bash, and TSX and didn't see it anymore, so I'll go poke= them about it now because it does seem like more of their problem. > > = > > It is quite possible that clojure-ts-clojurescript-mode defines some > > mode-specific data that makes treesit-query-compile do some heavy > > lifting. So I think you should report this to the mode developers. -----------------------c3a4e1a0b4d8e37db96552f8902a580a Content-Type: application/pgp-keys; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="publickey - alexispurslane@pm.me - 0x41E61568.asc"; name="publickey - alexispurslane@pm.me - 0x41E61568.asc" LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4ak1FWXlPNktCWUpLd1lCQkFI YVJ3OEJBUWRBaW0wYXBzbTJaTmd1N1lYU3VDLzNUVjUvenhNZE1tWDMKazhUZllSUVlRaXZOSzJG c1pYaHBjM0IxY25Oc1lXNWxRSEJ0TG0xbElEeGhiR1Y0YVhOd2RYSnpiR0Z1ClpVQndiUzV0WlQ3 Q2pBUVFGZ29BSFFVQ1l5TzZLQVFMQ1FjSUF4VUlDZ1FXQUFJQkFoa0JBaHNEQWg0QgpBQ0VKRVBQ S1ZsRUw1OThSRmlFRVFlWVZhTDAydVRUczdkdzI4OHBXVVF2bjN4RlJ2Z0QrTUUzdEhXOFgKdGpt NXdqeU9zVzQ1NjIxSEpGUXdGZnVnbGZZczlkVU03YTRBLzNFeEppdFVMTk1mdy9DRlVIbVAyR21T Ckp1blE1cENNYzkyM1FYdytPZjBMempnRVl5TzZLQklLS3dZQkJBR1hWUUVGQVFFSFFBVHJrMXFN Q0FVVgpDMFRBeFAvV3B6QjY4MG5DVmNlK1E2OVNPUWR6Uk9VY0F3RUlCOEo0QkJnV0NBQUpCUUpq STdvb0Foc00KQUNFSkVQUEtWbEVMNTk4UkZpRUVRZVlWYUwwMnVUVHM3ZHcyODhwV1VRdm4zeEc5 VkFFQTlDV1Q5bHVuCldWZG5MWis0RlpySUZKZW9EUFAzTE9Jd09oRFVnY1ZtZU8wQS9qdHVjYjRk eERzVTFiRjNkVjlHbGszaQo1SDJZcnIvRTJBYVlMbWFOVVBvTgo9SzRRaQotLS0tLUVORCBQR1Ag UFVCTElDIEtFWSBCTE9DSy0tLS0tCg== -----------------------c3a4e1a0b4d8e37db96552f8902a580a-- --------fcd25f0fb5c12fc4ede9171fc1ad0de2f0273a3a799661943986adfeb55b18f5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wrsEARYKAG0FgmhBsUwJkPPKVlEL598RRRQAAAAAABwAIHNhbHRAbm90YXRp b25zLm9wZW5wZ3Bqcy5vcmePIC+ISTmukWXMb6339DIGn6xEGys6vAPmUXnc 4mQ2IhYhBEHmFWi9Nrk07O3cNvPKVlEL598RAAD2ggD/cs4N4FQq4CFi/dcl 7Sdc+KhlVv4W9pkJuKmgOHBGbVgBAJab7Th4ENtEFJS3xUXYIgMWOpdm/wbF KZK4LBfRLaEA =w7qQ -----END PGP SIGNATURE----- --------fcd25f0fb5c12fc4ede9171fc1ad0de2f0273a3a799661943986adfeb55b18f5--