From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#60691: 29.0.60; Slow tree-sitter font-lock in ruby-ts-mode Date: Wed, 1 Feb 2023 17:11:16 +0200 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 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14199"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: 60691-done@debbugs.gnu.org, juri@linkov.net To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 01 16:12:35 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 1pNEmp-0003Ut-4a for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Feb 2023 16:12:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNEmW-0002Xq-Da; Wed, 01 Feb 2023 10:12:16 -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 1pNEmI-0002W1-KE for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 10:12:04 -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 1pNEmI-0003O1-Bq for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 10:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pNEmI-00016J-07 for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 10:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Feb 2023 15:12: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-done@debbugs.gnu.org id=D60691.16752642874187 (code D ref 60691); Wed, 01 Feb 2023 15:12:01 +0000 Original-Received: (at 60691-done) by debbugs.gnu.org; 1 Feb 2023 15:11:27 +0000 Original-Received: from localhost ([127.0.0.1]:59615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNElj-00015T-9p for submit@debbugs.gnu.org; Wed, 01 Feb 2023 10:11:27 -0500 Original-Received: from mail-ed1-f45.google.com ([209.85.208.45]:44917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNElh-00015G-Co for 60691-done@debbugs.gnu.org; Wed, 01 Feb 2023 10:11:26 -0500 Original-Received: by mail-ed1-f45.google.com with SMTP id v13so17972411eda.11 for <60691-done@debbugs.gnu.org>; Wed, 01 Feb 2023 07:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=WWAMMVpCzF/LjSUlkyr2+hsmrrPbH9+6RQ+pVqtxCdM=; b=otTSuOgavT/QIwmqmIqf5ZszfKckl/QO6/n9OZ5ja5SEMpPROI2AbVipDrriffNO3S 8OIoErrtU8thiGRua95PasPHbujIbcdfCawnzojxIWhpURndzmWE90ZiHQj13SxW1OI4 IYkXA9k1FTwkybc/OgpVkWE7LvJxUVNKKIs1y9ZCU1KMGerb1h++ex2TBNZTNNiS7GIx U8e/8BH80nWfLIdyhtdmZHyrTbbGQ0Qja/rstP2alxrZSkmv7VAdc+VxwLCK3aXS+zZx MJ6RXS6QL2ftlSCIHOY8zpMjInDocOobB2TNAGwxKs0n0CEJ91WfliXmLJRk6o/YNXYp NYYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WWAMMVpCzF/LjSUlkyr2+hsmrrPbH9+6RQ+pVqtxCdM=; b=iSH3EFJTkIYMB/gAx09WpKGZwCXG3diDppaPqz7AzxsjPUBLV6pRR3l2r3z+++KciY mSuQY61EnAmX2IXtOZb8/oAHQxXLjgGsTBdDIfh2OQJS185P6tHdiHCbme3d1z0pi/bm 4JZge4Spi8A2EDhDnxNfL0RByUqQNv847vWk/zt+j7a9yUVrxnptfo+PiCPkDOcF7XBv 7q1Jfo3cAyx3yUqd795/vRxIu1NVsBMUGX5I/rK/IIIuqJEKP34B5LDuZ8JQ+VYerJUh W0x7ncXU2LSxPmsxcNBumxmCp+tTTF8wLc6xN7GZBdMUnYQ1x84oztvV7M4b11KTDpQb nU5Q== X-Gm-Message-State: AO0yUKWabWlbZMpBAupy7/uJiDEB7H+zxMaXQkfGAQn3iZTjpzAj04Oy xMYC7FPQPajZqIwEIDXW9C8= X-Google-Smtp-Source: AK7set81F8Lpj9QhquRkDpuSrGPxbiMcVTD+UO1XqfKgfkNoFv4UKvkGYRVhHancA3Aj+jbUD69X4A== X-Received: by 2002:a05:6402:2742:b0:4a2:3371:cb82 with SMTP id z2-20020a056402274200b004a23371cb82mr3344088edd.18.1675264279414; Wed, 01 Feb 2023 07:11:19 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u20-20020a50a414000000b004a08c52a2f0sm10070376edb.76.2023.02.01.07.11.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Feb 2023 07:11:18 -0800 (PST) Content-Language: en-US In-Reply-To: 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:254586 Archived-At: On 01/02/2023 07:26, Yuan Fu wrote: >>> 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 “normal”, even huge files like xdisp.c is well below the bar. Therefore I don’t think “crossing the line” will realistically happen when editing source files. >>> Here is the stats of two “problematic files”, 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’d say that any regular source file, even mechanically generated, wouldn’t go beyond ~50 levels in depth, and hand-written files should never has a node that has 4000+ direct children in the parse tree. >> Oh, thanks for the explanation. Then the current strategy makes sense. >> >> Is xdisp.c absolutely the largest C file in your experience? >> >> According to the above numbers, a file that's only 4x as large could hit our current cutoff. > I don’t 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’d say it’s better not to turn on “fast mode” immediately. I see your point. In the previous message I was talking about a different scenario: when a project has a file 4x the size of xdisp.c, and the user just opens it. I suspect it's not great to have "fast mode" enabled in that case? Like, false positive. Anyway, this is a very theoretical concern on my part.