From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#60691: 29.0.60; Slow tree-sitter font-lock in ruby-ts-mode Date: Fri, 13 Jan 2023 01:15:09 -0800 Message-ID: References: <867cxv3dnn.fsf@mail.linkov.net> <6F1CC7E3-E5B2-4E51-93F6-455A2D0C771E@gmail.com> <0ba1ca9c-78e3-f961-787e-4758beaa3c5b@yandex.ru> <83r0vyamtb.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31435"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Juri Linkov , 60691@debbugs.gnu.org, Stefan Monnier , Dmitry Gutov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 13 10:16:23 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 1pGGAh-0007ya-D0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Jan 2023 10:16:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGGAQ-0005p7-Ah; Fri, 13 Jan 2023 04:16:06 -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 1pGGAM-0005o9-VR for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 04:16:03 -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 1pGGAM-0003AZ-B2 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 04:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGGAL-0004yA-Qv for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 04:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jan 2023 09:16:01 +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.167360132219049 (code B ref 60691); Fri, 13 Jan 2023 09:16:01 +0000 Original-Received: (at 60691) by debbugs.gnu.org; 13 Jan 2023 09:15:22 +0000 Original-Received: from localhost ([127.0.0.1]:49570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGG9i-0004xB-6E for submit@debbugs.gnu.org; Fri, 13 Jan 2023 04:15:22 -0500 Original-Received: from mail-pl1-f181.google.com ([209.85.214.181]:46730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGG9g-0004wv-Db for 60691@debbugs.gnu.org; Fri, 13 Jan 2023 04:15:21 -0500 Original-Received: by mail-pl1-f181.google.com with SMTP id jn22so22830061plb.13 for <60691@debbugs.gnu.org>; Fri, 13 Jan 2023 01:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=grdT2JPcyMNP8d/LqeBAZEhUtyUNSyPdL5gl1vq0JwQ=; b=bThSs0rp4hQV/OnYaq7tmwI6hjfM+5E/b3PJpDr3WBhRNi/viUR+Q4kfYQKWIjIwyU EItgHVlGzCZKVgU3E8bl9Npl7/WlaFEUQOsGmcr9HiAWY6n4JqTZg5VilQ23esOxXmBZ grBJW+kgWJSmEuhDW3BNDD452UiGwqev2PZkmpC33l7UCkBKVBWvJvBvovtYYM49xi2s Qwka22Z2s7nMP4YZQEeK356+o15ydGsPtVZ6IADbbFs/Sc3ABUor+vGmtXEBJ7AnO61d Yc2jDxqXwSQEagkdhbEtIV86tP7aV/XW6TNsPt8AAYphLwWI7kUN2SpPHkQLJiMgiqIK VHKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=grdT2JPcyMNP8d/LqeBAZEhUtyUNSyPdL5gl1vq0JwQ=; b=rmzSb2gpRZm3SqfJcWcHRTPdrznlxr7SQMx+CJTFLMk6TBMYy6G0QYdTCvXKmR9hcQ TRbm/H9j6U7PTOazcjznFSweonydJYtRgEVsr9SHsIgCbsi+wcALT59f4DFimEQFPXhO TnXWkOqZ914Rr8MqX74ds6Q9eJ8ESSfFubtaOi63s5+PAlZfo1jMiBwGRC5S47R9ulHR PYYwtXwBdNBd3fP7NVxwqINj+Bhymb0epgjkWztERcx8v86SKB03ecXnSDYyCYBqNqWs XaQrmXbV/vdMn7wG1WvnKLZ30emlIqhGYFSZtU188ym1M1bwntP3ZUPa2mt2snzaGlXY 4F/w== X-Gm-Message-State: AFqh2kof7hcb5GlE+bYYSxi4pBFALRz0HeOp6pFS6C+qoB9p7VJCJtGx KsrDtAVhY7YoeEuRTBHHzr8= X-Google-Smtp-Source: AMrXdXs491aEfVqGOkzMleIhIQp8QY8tXpp+MsNSsDX8VGQ815yIxeLK+jJIW3RfH8xVZHwrN6axhw== X-Received: by 2002:a17:902:edc5:b0:192:c882:703e with SMTP id q5-20020a170902edc500b00192c882703emr39929936plk.43.1673601314502; Fri, 13 Jan 2023 01:15:14 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id u11-20020a6540cb000000b0046ff3634a78sm11320328pgp.71.2023.01.13.01.15.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2023 01:15:14 -0800 (PST) In-Reply-To: <83r0vyamtb.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:253276 Archived-At: > On Jan 12, 2023, at 11:57 PM, Eli Zaretskii wrote: >=20 >> Cc: 60691@debbugs.gnu.org, juri@linkov.net >> Date: Fri, 13 Jan 2023 01:40:56 +0200 >> From: Dmitry Gutov >>=20 >> Managed to reproduce this after running the test in a couple of=20 >> different files. >>=20 >> But 'M-x memory-usage' says no such command, and 'M-x memory-report'=20= >> ends up with this error: >>=20 >> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p = nil) >> memory-report--gc-elem(nil strings) >> memory-report--garbage-collect() >> memory-report() >=20 > 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. >=20 > And I think I see the problem: we use build_pure_c_string in treesit.c > in places that we shouldn't. >=20 > 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: >=20 > . 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 Can I define a bunch of static C variables and initialize them in = syms_of_treesit, or they have to be all Lisp variables? Eg, static Lisp_Object TREESIT_STAR; ... void syms_of_treesit (void) { ... TREESIT_STAR =3D build_pure_c_string ("*"); ... } Yuan=