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#60691: 29.0.60; Slow tree-sitter font-lock in ruby-ts-mode Date: Fri, 13 Jan 2023 09:57:52 +0200 Message-ID: <83r0vyamtb.fsf@gnu.org> References: <867cxv3dnn.fsf@mail.linkov.net> <6F1CC7E3-E5B2-4E51-93F6-455A2D0C771E@gmail.com> <0ba1ca9c-78e3-f961-787e-4758beaa3c5b@yandex.ru> 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="26001"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60691@debbugs.gnu.org, Stefan Monnier , juri@linkov.net To: casouri@gmail.com, Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 13 08:59:18 2023 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 1pGEy2-0006Ws-J0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Jan 2023 08:59:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGExs-0001LP-2F; Fri, 13 Jan 2023 02:59:04 -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 1pGExq-0001LG-Tl for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 02:59:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGExq-0004Fr-LH for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 02:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGExq-0000cY-H1 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 02:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jan 2023 07:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60691 X-GNU-PR-Package: emacs Original-Received: via spool by 60691-submit@debbugs.gnu.org id=B60691.16735966912318 (code B ref 60691); Fri, 13 Jan 2023 07:59:02 +0000 Original-Received: (at 60691) by debbugs.gnu.org; 13 Jan 2023 07:58:11 +0000 Original-Received: from localhost ([127.0.0.1]:49444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGEx1-0000bJ-52 for submit@debbugs.gnu.org; Fri, 13 Jan 2023 02:58:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGEwz-0000b7-95 for 60691@debbugs.gnu.org; Fri, 13 Jan 2023 02:58:09 -0500 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 1pGEwl-00043c-Ue; Fri, 13 Jan 2023 02:58:03 -0500 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=7SqaeqM7TefYeYdaQoiAgZ8yRV2f2LhqjeZu/WeQesA=; b=TAYP8vHh4M1fFMkMZ+AJ /W4Yij1VZlOeA29vsX13ksDTIHjcpvpNMxbhg1b0vv57CRo+gx/j8WPcnY44pKYTjifyNAcfql71r OYHFJnKlmKNWbbp44gR6K/oJX4vNaogJ6gEBKek8YmCykOi279FIX1m1xgSnKMzz2w0fxaGOUc3bR XhbQRDK/XWQ0jg15D6NcPhO3sEMhliQoPFQ4nT6YxwnIQFRV0mUnOMXfU7sbn884VVdOe8dugBeZS W93u8ktK989JbDseVn7YN1YACG18soPus+wjp9l04halMOq932XHMVXMyleJfnf/GMSCh5s8CVh+Q 0lRSjgDqxXEE0g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGEwk-0008Bi-4R; Fri, 13 Jan 2023 02:57:55 -0500 In-Reply-To: <0ba1ca9c-78e3-f961-787e-4758beaa3c5b@yandex.ru> (message from Dmitry Gutov on Fri, 13 Jan 2023 01:40:56 +0200) 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:253267 Archived-At: > Cc: 60691@debbugs.gnu.org, juri@linkov.net > Date: Fri, 13 Jan 2023 01:40:56 +0200 > From: Dmitry Gutov > > Managed to reproduce this after running the test in a couple of > different files. > > But 'M-x memory-usage' says no such command, and 'M-x memory-report' > ends up with this error: > > Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) > memory-report--gc-elem(nil strings) > memory-report--garbage-collect() > memory-report() This means GC is disabled in this session at the time you invoke memory-report. Which shouldn't happen, of course. It sounds like your pure Lisp storage overflowed, and that disabled GC. And I think I see the problem: we use build_pure_c_string in treesit.c in places that we shouldn't. Yuan, build_pure_c_string should only be used in places such as syms_of_treesit, which are called just once, during dumping. Look at all the other calls to this function in the sources, and you will see it. In all other cases, you should do one of the following: . for strings whose text is fixed, define a variable, give it the value in syms_of_treesit using build_pure_c_string, then use that variable elsewhere in the source . for strings whose text depends on run-time information, use AUTO_STRING or build_string This is a serious problem, and we should fix it ASAP. > garbage-collect's docstring says: > > However, if there was overflow in pure space, and Emacs was dumped > using the "unexec" method, ‘garbage-collect’ returns nil, because > real GC can’t be done. > > I don't know if my Emacs was dumped using "unexec", though. ./configure > says I'm using pdumper. The above text doesn't account for bugs ;-) Functions that produce objects in pure space are supposed to be called only during the build, a.k.a. "when dumping", and for that the text is correct.