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: Tue, 31 Jan 2023 21:26:11 -0800 Message-ID: References: <867cxv3dnn.fsf@mail.linkov.net> <90D8581D-C543-43EE-8BEB-51B5AFBCBAEE@gmail.com> <0e552ada-081f-ad90-19c2-645a64ef50ac@yandex.ru> <152c2d15-ab5c-ff35-f79b-71691fc223f8@yandex.ru> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20286"; mail-complaints-to="usenet@ciao.gmane.io" Cc: juri@linkov.net, 60691-done@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 01 08:00:40 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 1pN76m-0005AH-6d for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Feb 2023 08:00:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pN71M-0001er-6y; Wed, 01 Feb 2023 01:55: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 1pN71L-0001eW-FR for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 01:55: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 1pN71L-0004Nb-4q for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 01:55:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pN71K-0007Hu-AX for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 01:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Feb 2023 06:55: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-done@debbugs.gnu.org id=D60691.167523449127984 (code D ref 60691); Wed, 01 Feb 2023 06:55:02 +0000 Original-Received: (at 60691-done) by debbugs.gnu.org; 1 Feb 2023 06:54:51 +0000 Original-Received: from localhost ([127.0.0.1]:56254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN719-0007HH-0l for submit@debbugs.gnu.org; Wed, 01 Feb 2023 01:54:51 -0500 Original-Received: from mail-oi1-f177.google.com ([209.85.167.177]:40912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN716-0007Gw-Cv for 60691-done@debbugs.gnu.org; Wed, 01 Feb 2023 01:54:49 -0500 Original-Received: by mail-oi1-f177.google.com with SMTP id s66so14936973oib.7 for <60691-done@debbugs.gnu.org>; Tue, 31 Jan 2023 22:54:48 -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=yghn100hqnq+asIhDyug5gwPGWU4Dt5pLb8rRSr1U8U=; b=khyPJ+eN+pF0rKE1G+tD4Xa0Fyj+8K8hPKi91m4UYu24s0m7hf0k+zg4bSR8D1ceVN gqoEbBQ6cipYmiqiXHjTT4Q8CRQ1wsmdt8U+Ak1qzG9vkLLok9WznKhZT1ABujIDY9KV lex827u1zL85mIcW+z9O2S06sY5WP0N/AXeWzZuLDoq35B1FBePUJDhc7dfrREANlIw8 4COpkQqaLp2+351jqrpK0tNYBXHvzPEgv9JUjezpzFeKrL1TujzXBvEqpKEZJWZYpCmc LLU53Fo+UWOL9jdcmGTJQB9qfCJ/HbF/fxTIOFz6ZzOTTpAFzQ4E6jGvZyX1VP5xxst7 JTvw== 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=yghn100hqnq+asIhDyug5gwPGWU4Dt5pLb8rRSr1U8U=; b=XuBx0NsyCNWEZYXV8S/2qpfyZbB5uSh5JZny6pSQb9tudHDI+wu+cw7B6Q4pYlKHOM 01TYg+H8x3kR63id0CwOXFT+YTS8mASQQ0VPpRsx4VAJypG8bUUz+rtA5xcWTAF6YXNY vfQjRhtQy4RESla+4BZ3t1llJRKGdjDQ9O+z2tNEJGlTdun2NBV2IZr3xUwHDu6xbXLV m5Vwz6q2l7CvYOwMAeGNk9NOib7Ssy8hzFCbNcEaPh2tOimDS0FAWtYTnnBEM6LP8ng8 NipT3OJzd4DJQDKR0q+pOImTa4mwn8j5iY7S5XF7Vx2aDGyUPaasESj8Q+ilj9TC1sxW 7Lsg== X-Gm-Message-State: AO0yUKVWcjf1X53rOSDqf7cMDTDUIf04NaarK6MW4JD1bp7ymIfH5LX8 xxFDtrJ/hqryvv96c5gYkMxN1CnML8M= X-Google-Smtp-Source: AK7set80z01PHYwEcDV2fg0X62CXL4EYXmhvlef2z/oUtDrHmcukinKkgMQXbOeazvozlNI0Xg+9xQ== X-Received: by 2002:a17:90b:1651:b0:22c:3544:8cb0 with SMTP id il17-20020a17090b165100b0022c35448cb0mr1062348pjb.8.1675230069869; Tue, 31 Jan 2023 21:41:09 -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 q8-20020a17090a178800b0022badab0dbasm434903pja.3.2023.01.31.21.41.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2023 21:41:02 -0800 (PST) In-Reply-To: <152c2d15-ab5c-ff35-f79b-71691fc223f8@yandex.ru> X-Mailer: Apple Mail (2.3731.300.101.1.3) 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:254561 Archived-At: >> I should mention this in the comments, but the fast mode is only for = very rare cases, where the file is mechanically generated and has some = peculiarities that causes tree-sitter to work poorly. If the file is = hand-written and =E2=80=9Cnormal=E2=80=9D, even huge files like xdisp.c = is well below the bar. Therefore I don=E2=80=99t think =E2=80=9Ccrossing = the line=E2=80=9D will realistically happen when editing source files. >> Here is the stats of two =E2=80=9Cproblematic files=E2=80=9D, named = packet and dec_mask, comparing to xdisp.c: >> ;; max-depth max-width count >> ;; cut-off 100 4000 >> ;; packet (98159 46581 1895137) >> ;; dec mask (3 64301 283995) >> ;; xdisp.c (29 985 218971) >> I=E2=80=99d say that any regular source file, even mechanically = generated, wouldn=E2=80=99t go beyond ~50 levels in depth, and = hand-written files should never has a node that has 4000+ direct = children in the parse tree. >=20 > Oh, thanks for the explanation. Then the current strategy makes sense. >=20 > Is xdisp.c absolutely the largest C file in your experience? >=20 > According to the above numbers, a file that's only 4x as large could = hit our current cutoff. I don=E2=80=99t think these stats increase linearly as the file size = increases. Even if there is a file that has a node with 3999 direct = children, and the developer adds another one, I=E2=80=99d say it=E2=80=99s= better not to turn on =E2=80=9Cfast mode=E2=80=9D immediately. Yuan=