From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 19:39:54 2023 Received: (at submit) by debbugs.gnu.org; 5 Feb 2023 00:39:54 +0000 Received: from localhost ([127.0.0.1]:43666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOT4T-00032i-0Z for submit@debbugs.gnu.org; Sat, 04 Feb 2023 19:39:54 -0500 Received: from lists.gnu.org ([209.51.188.17]:56606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOT4N-00032W-5c for submit@debbugs.gnu.org; Sat, 04 Feb 2023 19:39:51 -0500 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 1pOT4M-0000Fy-NH for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 19:39:46 -0500 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOT4K-0003ad-Bm for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 19:39:46 -0500 Received: by mail-ed1-x532.google.com with SMTP id z11so8486126ede.1 for ; Sat, 04 Feb 2023 16:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:sender:from:to:cc:subject :date:message-id:reply-to; bh=bcPopwKw/jZVDuD0rMoLu3xscbawXWDzUFhNKS4VcjY=; b=TKnONITubH6KI1erho0xHgKsCOk2Zuy1DJdtdjHOQVt89jZuZZgvgDSlKLumyGnahg jaMfPT0PLmOvbyugD7laxQ97iR6CtC9QgM59psvXf/cH3hPhDz645JEpZ7xZ8/TaejVy wgDAJo3NUYKBuDS/hF9mnBsER5JFZmKKTn0MfKFvL+HSLy435CTjmhW2HQZoBYbUa17T OBTamQE5m5J/oXnxy8pdTsLm4qw9OQ7o+sQDhbNXrMSsZsHyCv3w8Arh6D08i7dn19sX JxwuIK+PKdq5gn1wYCX89GbIn6nySdOKrGJ7/vlRZM1+x/7KXvftjisUwEZFxhTGhnxJ 6yog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bcPopwKw/jZVDuD0rMoLu3xscbawXWDzUFhNKS4VcjY=; b=v00o1niX6FNHlIXOhch0NIyL3I5JBpZPVcGq73lu9CN4SJny6ErfSdXXRwzbpbEEwh zdGL3OoZ+AsKmz7orXYJ0DpOSbKhefOV0aJkGuoXUcALPhrQsjRPyHjlv0Is/gkTjE4L hUN3NHjRmEJwcyisHZMSnFDkQrfhrzZrXOzNkU7Pj5rKcdqIoig1mBE94qhSB1pyjbPA tfWSOMnsuw8+NWx8hvJRLdbzH9KRmw50+hXpjjEJOOVtuKb2sBOWfM+0F6FX3C74J27O i4F+XksakFrfC7PknjY/kmHNqLh/ERY4Q+FxorCgveli3v345Ajw7XC97UuLiE82G2ui GhcQ== X-Gm-Message-State: AO0yUKXTfEgfzllzUSsCjAs7NjzAud4K5MC8/ioquKfPaI+ilKCBQowY eoK0d8/ouYeQPZP/rgiD1Z+YEjsA++M= X-Google-Smtp-Source: AK7set+7C5PYHphraYdLQLOdVcp3XyjL8fH2fl9hbEIKPN5yT1CWMmeSrAOwxvs+gprWlOKSMko7mw== X-Received: by 2002:a50:d7cd:0:b0:4aa:a40a:3bd6 with SMTP id m13-20020a50d7cd000000b004aaa40a3bd6mr2584266edj.24.1675557580581; Sat, 04 Feb 2023 16:39:40 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id b12-20020a056402350c00b0049e210884dasm3150478edd.15.2023.02.04.16.39.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Feb 2023 16:39:39 -0800 (PST) Message-ID: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> Date: Sun, 5 Feb 2023 02:39:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US To: bug-gnu-emacs@gnu.org From: Dmitry Gutov Subject: (Sometimes very) slow font-lock after %w in ruby-ts-mode Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=raaahh@gmail.com; helo=mail-ed1-x532.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) 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: -2.1 (--) This probably involves a parser bug and/or maybe a tree-sitter one. But I'm posting this here anyway because this might not be the only way to trigger this problem. Or it could give us some optimization insights. Also, while it involves a node which is parsed to have a large number of descendants, the performance depends heavily on whether the node is at the top level of the program (then it's slow), or not. To repro: 1. Visit test/lisp/progmodes/ruby-mode-resources/ruby.rb 2. add 'a = %w' (without quotes) as a separate new line before all of the existing code. 3. Notice the delay in redisplay after you type 'w'. In you do that with a larger file, BTW, this delay may be on the order of a minute. Here's an example of such file: https://github.com/rails/rails/blob/main/activerecord/lib/active_record/associations.rb The superficial reason for this delay is that %w opens a new "array of strings" literal which parses every separate word in the rest of the buffer as a separate string. So we get a node with thousands of children, in the case of associations.rb. Or just ~1000 in the case of ruby.rb. I also tried setting treesit--font-lock-fast-mode to t: no effect. But! If we do the same not on top-level -- say, put the 'a = %w' line after the 'foo' line inside the first 'if' statement (i.e. on line 7), the delay is much smaller -- not noticeable in ruby.rb, and still apparent but much more bearable in associations.rb (you can put that statement right after 'module ActiveRecord') -- even though the size of the tree is changed minimally, and the number of children nodes for that "array of strings" still counts in the thousands (e.g. 13319). Perf report for the "bad" highlighting delay looks like this: 61.19% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_current_status 30.88% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_parent_node 7.44% emacs libtree-sitter.so.0.0 [.] ts_language_symbol_metadata 0.06% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_goto_first_child 0.05% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_goto_next_sibling 0.03% emacs libtree-sitter.so.0.0 [.] ts_node_end_byte And like this in the "good" case (with many type-backspace repetitions): 32.10% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_current_status 9.50% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_goto_first_child 7.89% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_goto_next_sibling 7.51% emacs libtree-sitter.so.0.0 [.] ts_language_symbol_metadata 6.45% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_parent_node 1.87% emacs libtree-sitter.so.0.0 [.] ts_node_start_point 1.85% emacs emacs [.] process_mark_stack 0.93% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_current_node From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 19:08:57 2023 Received: (at 61285) by debbugs.gnu.org; 6 Feb 2023 00:08:57 +0000 Received: from localhost ([127.0.0.1]:46758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOp44-0006xw-Kz for submit@debbugs.gnu.org; Sun, 05 Feb 2023 19:08:57 -0500 Received: from mail-pj1-f41.google.com ([209.85.216.41]:37837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOp42-0006xh-7S for 61285@debbugs.gnu.org; Sun, 05 Feb 2023 19:08:54 -0500 Received: by mail-pj1-f41.google.com with SMTP id c10-20020a17090a1d0a00b0022e63a94799so13651259pjd.2 for <61285@debbugs.gnu.org>; Sun, 05 Feb 2023 16:08:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=7nJV3m2659JxdgFr8rMpzKKUXncrIfhrKeT4r7KqLdc=; b=a9Y1V/DR0jT7LUIm+u6T9Ju2ugQCitkwh/z/7WoY+sD1qVFj78qAbMZe/ri1mr7f5c LsrZtmf0rNPt/MxVa9kWDFRm9QbxxMaiBq0rGibaUT28AoV0T7l1hWVy5rR1tdN9QzCb 6nbnDeqQvf5A5sOKVZH7Zte1icXIrBJOIA0PsMAEFxUSUbGaChShcagye4Lw0dOiopCE bfuRIrTUvkKrK8Fnoe3AbEPf7JKsixtLpiIenbYzFiHPRbzmUQ6bvFjX+WjgSnhxdUKE FhHc93TePUJce9QKcvpw6NShSYTqHpetbW0PX51WWh5ezETndmaOfJjVvS3epe1Qh9Jw Uyng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7nJV3m2659JxdgFr8rMpzKKUXncrIfhrKeT4r7KqLdc=; b=cfuU4Ck5hMqu6ggDGEU1JEcxhfj1HScFqdzovb2gPFGZhEa6PGbYe785Biy1l1mP8q OOaYrcc2I4qXz+7l8f8E7DktR/bC5hLuzQqAwCL95lLv7KXOh3uqppEr44nNwN355Bfa eVi8Xfg3kuqpH1XrH3jac6MYvEAAF2j+Om3b5bC2fMZDoEY3ZC3LGIpjn1LMW9qrtDIS gIJetl4gi7svewADaWlSTvVbRFStHQPQaspvrBX7Tdyh8NvvYVW5kAvVMXDYpC8Sz2oR fSIxcb1IJSY3Onh6gTBpFvgBC2qmAcZ/PaF+9Zl3me7V4b+9JYldQ2UL9fdgEGLM4BSY mEJg== X-Gm-Message-State: AO0yUKXzvcIy2z/vhQlzIEvxYBVlJWC9GkWj2Kt/F9UImKAazRWwuQfV FL2vPmExwGkGUWQC7KQTutA= X-Google-Smtp-Source: AK7set+ZgRVRIV+ob+h6xw0OqsFEKAh7Q5Twu0lqK21gZW/SoaHfO/RhH3lDNHfyQ6C+bY7XyHjEPw== X-Received: by 2002:a17:903:1247:b0:195:e92e:c4d3 with SMTP id u7-20020a170903124700b00195e92ec4d3mr22323133plh.46.1675642128026; Sun, 05 Feb 2023 16:08:48 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g24-20020a1709029f9800b0019663238703sm3168204plq.109.2023.02.05.16.08.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Feb 2023 16:08:47 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode Message-Id: <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> Date: Sun, 5 Feb 2023 16:08:36 -0800 To: Dmitry Gutov X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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 (-) Dmitry Gutov writes: > This probably involves a parser bug and/or maybe a tree-sitter one. > But I'm posting this here anyway because this might not be the only > way to trigger this problem. Or it could give us some optimization > insights. > > Also, while it involves a node which is parsed to have a large number > of descendants, the performance depends heavily on whether the node is > at the top level of the program (then it's slow), or not. > > To repro: > > 1. Visit test/lisp/progmodes/ruby-mode-resources/ruby.rb > 2. add 'a =3D %w' (without quotes) as a separate new line before all = of > the existing code. > 3. Notice the delay in redisplay after you type 'w'. > > In you do that with a larger file, BTW, this delay may be on the order > of a minute. Here's an example of such file: > = https://github.com/rails/rails/blob/main/activerecord/lib/active_record/as= sociations.rb > > The superficial reason for this delay is that %w opens a new "array of > strings" literal which parses every separate word in the rest of the > buffer as a separate string. So we get a node with thousands of > children, in the case of associations.rb. Or just ~1000 in the case of > ruby.rb. > > I also tried setting treesit--font-lock-fast-mode to t: no effect. > > But! If we do the same not on top-level -- say, put the 'a =3D %w' = line > after the 'foo' line inside the first 'if' statement (i.e. on line 7), > the delay is much smaller -- not noticeable in ruby.rb, and still > apparent but much more bearable in associations.rb (you can put that > statement right after 'module ActiveRecord') -- even though the size > of the tree is changed minimally, and the number of children nodes for > that "array of strings" still counts in the thousands (e.g. 13319). > > Perf report for the "bad" highlighting delay looks like this: > > 61.19% emacs libtree-sitter.so.0.0 [.] = ts_tree_cursor_current_status > 30.88% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_parent_node > 7.44% emacs libtree-sitter.so.0.0 [.] ts_language_symbol_metadata > 0.06% emacs libtree-sitter.so.0.0 [.] = ts_tree_cursor_goto_first_child > 0.05% emacs libtree-sitter.so.0.0 [.] = ts_tree_cursor_goto_next_sibling > 0.03% emacs libtree-sitter.so.0.0 [.] ts_node_end_byte > > And like this in the "good" case (with many type-backspace = repetitions): > > 32.10% emacs libtree-sitter.so.0.0 [.] = ts_tree_cursor_current_status > 9.50% emacs libtree-sitter.so.0.0 [.] = ts_tree_cursor_goto_first_child > 7.89% emacs libtree-sitter.so.0.0 [.] = ts_tree_cursor_goto_next_sibling > 7.51% emacs libtree-sitter.so.0.0 [.] ts_language_symbol_metadata > 6.45% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_parent_node > 1.87% emacs libtree-sitter.so.0.0 [.] ts_node_start_point > 1.85% emacs emacs [.] process_mark_stack > 0.93% emacs libtree-sitter.so.0.0 [.] ts_tree_cursor_current_node Interesting. Perhaps it has to do with how tree-sitter implements the "incremental" part of the parser? But the profile doesn=E2=80=99t look = like it=E2=80=99s spending time parsing, I need to look at what does ts_tree_cursor_current_status actually do (maybe it=E2=80=99s used in = parsing?) Yuan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 20:03:16 2023 Received: (at 61285) by debbugs.gnu.org; 6 Feb 2023 01:03:16 +0000 Received: from localhost ([127.0.0.1]:46813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOpud-0002Dm-Ki for submit@debbugs.gnu.org; Sun, 05 Feb 2023 20:03:15 -0500 Received: from mail-ed1-f49.google.com ([209.85.208.49]:34409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOpub-0002DZ-Sh for 61285@debbugs.gnu.org; Sun, 05 Feb 2023 20:03:15 -0500 Received: by mail-ed1-f49.google.com with SMTP id z11so10191479ede.1 for <61285@debbugs.gnu.org>; Sun, 05 Feb 2023 17:03:13 -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=vEUCsIgdPCKGif500F9XUGcECCGyfpuNI98UbZ2Qrq8=; b=Zjx5PNjBjG/X+eB9eQuP4RU2nnICu7iTASCz4hRjKU80Fn8gotwiahhyoEl1J0Nb1H Al7Gyc5jhasAtcst4PDhH5X0fd+SA15c9Y4Vi7KRG1myPKbDLzDLNpDbTiELNZsMkXZ0 SQc3w2c/YWfr2VKH4iFzegbuKrTjN9Gp+V2yeZrC4v6tIvRR34fsIrpdt6PjJLuybT47 cr43o4Arx2JBI86CJ0p2cRAnxnu0Jv+JjyAeX/4nFfj32A7dREEXUbmwCD222tWulcQT y6x4EsEfx4Ixjoh/Z3qtQNk9w8xx66a1OU1RsxcSdGTd0rOgiQrG2Cxv+J5qML0ISKWv ujmA== 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=vEUCsIgdPCKGif500F9XUGcECCGyfpuNI98UbZ2Qrq8=; b=LAZ+9a5+ZHNE7KpEcG87UNMH87MYalyREPsptPSl8U0M1dblXiZcn3JxDMwgi02pd5 IJxrLvw0qJB/Euc+ZU6RjeWzkOYIa6rNnRAf0i/y1ADOaHxzy+fXYmYhIqOnuEzPxAZv WJ6fdq0ai/TT+6k+35j5SXMoywuVdw0aGFX1FW1OuEOZzfqAFnL801b/N0MP6v+b7K8K SdKKKSpmooWcZU1htntT0kU3YlOR4PToZne8HoQNvtrXz1wIdARy+BVsoYYC614hLRQ+ u+rl+gR5J3PIZwjnsuDKd33o44H2wGNuw8hcdiPe3xoo7s7iemQGgJRLrKIg/z+hPNbF wniA== X-Gm-Message-State: AO0yUKWv3tBp+3SyEeFoqvF2a8Ed0vSoxLAJQauRnnO8aZ/FpUrCgDCf yT4Rzqg87KWzBT+Y3onG+UQ= X-Google-Smtp-Source: AK7set+tdrMJoPJQpzLif6tkkT0ePqNs0bgEgxTXew5IsITN66bofub2R31Vk7kuDTQznkAK+5a6CA== X-Received: by 2002:a50:8d1d:0:b0:4aa:a4dd:9746 with SMTP id s29-20020a508d1d000000b004aaa4dd9746mr6029533eds.39.1675645388036; Sun, 05 Feb 2023 17:03:08 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id l21-20020a50d6d5000000b004aab36ad060sm489314edj.92.2023.02.05.17.03.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Feb 2023 17:03:07 -0800 (PST) Message-ID: <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> Date: Mon, 6 Feb 2023 03:03:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode Content-Language: en-US To: Yuan Fu References: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> From: Dmitry Gutov In-Reply-To: <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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.9 (-) On 06/02/2023 02:08, Yuan Fu wrote: > Interesting. Perhaps it has to do with how tree-sitter implements the > "incremental" part of the parser? But the profile doesn’t look like it’s > spending time parsing, According to my tests, what gets slower are the treesit-query-capture calls. And I mean all of them (for every element in treesit-font-lock-settings), not just the first one, which I imagine would be the case if tree-sitter needed to finish parsing the current buffer contents. If I just wrap the treesit-query-capture calls inside treesit-font-lock-fontify-region in benchmark-progn, with %w inside the 'if' block the queries are an order of a magnitude faster than with it at top level. E.g. in the ruby.rb example, the former look like ... Elapsed time: 0.001648s Elapsed time: 0.001498s Elapsed time: 0.001211s Elapsed time: 0.000949s Elapsed time: 0.000950s ... and the latter are like ... Elapsed time: 0.006567s Elapsed time: 0.006583s Elapsed time: 0.007072s Elapsed time: 0.006867s Elapsed time: 0.006575s Elapsed time: 0.006608s ... Multiply that by 19 (the number of rules), and we get the perceived delay. And for associations.rb, the query times are 0.004322s vs 1.083029s. > I need to look at what does > ts_tree_cursor_current_status actually do (maybe it’s used in parsing?) // Private - Get various facts about the current node that are needed // when executing tree queries. void ts_tree_cursor_current_status( https://github.com/tree-sitter/tree-sitter/blob/84c1c6a271cd0ab742ce0f46cd3576a6f6bf5b8c/lib/src/tree_cursor.c#L284 I see it is called by ts_query_cursor__advance, which is in turn called by ts_query_cursor_next_match. And ts_query_cursor_next_capture, which we don't seem to be using. Here's an existing report on its tracker which might be relevant: https://github.com/tree-sitter/tree-sitter/issues/1972 Similar perf report, though not exactly the same. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 22:21:11 2023 Received: (at 61285) by debbugs.gnu.org; 6 Feb 2023 03:21:11 +0000 Received: from localhost ([127.0.0.1]:47043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOs47-0005gc-Fs for submit@debbugs.gnu.org; Sun, 05 Feb 2023 22:21:11 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:47091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOs42-0005fk-2p for 61285@debbugs.gnu.org; Sun, 05 Feb 2023 22:21:09 -0500 Received: by mail-wm1-f46.google.com with SMTP id bh13-20020a05600c3d0d00b003dff6cd8b7eso2540387wmb.5 for <61285@debbugs.gnu.org>; Sun, 05 Feb 2023 19:21:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=o2EFmBL+vnbZBsK1wft918emSXCMRu/U48UtYLPG5B0=; b=QnJttNFpNP4TmsDF+PngCRYIHXP6E/NJ1m3cL7bIiMDRSkhj1adOMrY1oecFlUJ77J tsZwZ4aBXuMV5Vbp8H02otqijesmrK4Lw9+KNc6GlTq3owxwkI7EjeV/tiSxKIIDUi8q BOpKQ246BJj0QGzPiSbVG8b2qdRL30QwdfDErkw6cq8Tl5ITuF2p2y9/WLJ3R+ho78mv aGD3Jm1BuCtzfXtv/S6EbEnee7gWNS1MEsyZ8VILO2ExZSr3I75BT71QJXKg5yCPxCAg LPXSPHWU+psYiQtHpR3NPDOJzZDhN3eu41FheHVvuvFtiHeMHI4txnJC0Rp73DttcTtL 839g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :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=o2EFmBL+vnbZBsK1wft918emSXCMRu/U48UtYLPG5B0=; b=jKpVkFrHHH5n5UKAbDUh1nwMcqZ5XnPKCEoOISotmU8i6jYCQ/ZGxSQSnx0VAxQci8 ml10wNPKsecxjG+o6do/FAOBaud1CrMi1/8uoDJEDwRPkwEh+f+jmKbaFNicsMKlaZb9 5Jl8/9UgWdV9teTyN5Qqw6ayxJcrhuvdpCrWY3pM/KjtWYRFn9fTsBRrKzY2S/wMamUc OCklxN6fLIULUEdV2DxEZADpnSl7XjPH97bnGxR4CAvGTwPlf33SuW/pTVFVmN5YJekY n34QrmUv3n7VwF4YCPcZxiy1KVTT4ZTG9GeWrqS7RGgF2BuoOL8HwzTLVM6/0w5MaPkI hexw== X-Gm-Message-State: AO0yUKWBhlxo6AHEJDGmHaAGpNsB10Rbi/rblNrzK19tZZhoEcoyRtR3 8qpcFAvMg0sZNsB/5ngqpDk= X-Google-Smtp-Source: AK7set9AJyLVBNCjAjZA8WWrxdy5+6C6+IiQFLDUPGw8SVS/mrds+IYx/OzWJpd9f9AEHsDzU/IkQA== X-Received: by 2002:a05:600c:3d8a:b0:3dd:af7a:53ed with SMTP id bi10-20020a05600c3d8a00b003ddaf7a53edmr18322875wmb.11.1675653659834; Sun, 05 Feb 2023 19:20:59 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id l20-20020a05600c089400b003dc41a9836esm9359491wmp.43.2023.02.05.19.20.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Feb 2023 19:20:59 -0800 (PST) Message-ID: <8d2075c6-7d1e-81b6-ac17-c21bea65e377@yandex.ru> Date: Mon, 6 Feb 2023 05:20:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode Content-Language: en-US From: Dmitry Gutov To: Yuan Fu References: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> In-Reply-To: <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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.9 (-) On 06/02/2023 03:03, Dmitry Gutov wrote: > And for associations.rb, the query times are 0.004322s vs 1.083029s. Similarly, using tree-sitter-cli, time tree-sitter query associations-query.scm associations.rb with a simple query also reports ~1.3s here. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 20 22:12:29 2023 Received: (at 61285) by debbugs.gnu.org; 21 Feb 2023 03:12:30 +0000 Received: from localhost ([127.0.0.1]:54067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUJ4v-00073g-K1 for submit@debbugs.gnu.org; Mon, 20 Feb 2023 22:12:29 -0500 Received: from mail-wm1-f50.google.com ([209.85.128.50]:34729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUJ4r-00073N-PC for 61285@debbugs.gnu.org; Mon, 20 Feb 2023 22:12:28 -0500 Received: by mail-wm1-f50.google.com with SMTP id l38-20020a05600c1d2600b003dff4480a17so1456194wms.1 for <61285@debbugs.gnu.org>; Mon, 20 Feb 2023 19:12: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:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Nq+GPu6GOcwcWhtqWXINnQk+5MJ1GY9zAyT7z+4YPj4=; b=m6OiN26x3zBK66z5xEwUV4xEyyQxwfdqIQ/lua6M/FPxXdz6eZUej8VvQ9TvTXNPMn eGA82U+SCqTUbWwztRhqRjtrY8pi5j6CKKouCJjPe0L7fCYxwX2rbiM3Or8qYqTgcMmZ WT4mkHvWxHzZ//pNv6/3I5usntMcAQ/K/XWX9Ugo51C1xPqxH5K/Wut2+6UY0fVxKz4/ TvXiJ73JUFxmu3+rSF/jOXiN2FNey2ZeXrpUnUwgd5Mkqdr9b0vCFh5JKWzLykGGfwq7 QtbspdUH3Ee8/w8nBn/7K/9fdEYqIMd0vSAU9euUgVz2OuAdgELfNkXOyrvXz1O5h/BF OfFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :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=Nq+GPu6GOcwcWhtqWXINnQk+5MJ1GY9zAyT7z+4YPj4=; b=OSQFnegL4UH/4oOQg9NnLpDERQ7FilauP8BLoxfQlzydFVqHBtbUVRnafDn89P91dF 2KsT8vNNGKEafPHJs677Y43z/P+oL87vjsXYfSw9WaDnzu7bWBdop+EisInrLYf6MM/e zxGHSnNEf56orZIe7spDvGOQbSTIlcT6Zi3KIsQedhvWPRp28e/QsQuUkoM7YxkxKzx/ pN3dHJi5/9yTLEgn2OckGDa/53x2RRfH+ZS/XaCJ1rdLqx0xaHh9zpp2alTecFjaTGmr d1UeBtBu0gegvbkroJUibSOHGxgQWGvN4+/TylhSFM0K2Eo0NyNBs1x9tdk3/pStlos4 p8EQ== X-Gm-Message-State: AO0yUKX5EW122TXa6a6NgTcYJzfVJcszF8svACgplz4wD6FYnnRSv5PM jvX8DoQ/h5pIFpzZOp040Vc= X-Google-Smtp-Source: AK7set+/9/Ap0Ph/Vd9svbn4T7C8sJ6tP0kqVZZvhgct5x0YQnSMJ6gx3Zm9MneVcBViCPGAL/RDZA== X-Received: by 2002:a05:600c:3c84:b0:3dc:545f:e9ce with SMTP id bg4-20020a05600c3c8400b003dc545fe9cemr2291995wmb.24.1676949139687; Mon, 20 Feb 2023 19:12:19 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id o10-20020a1c750a000000b003e7c89b3514sm211817wmc.23.2023.02.20.19.12.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Feb 2023 19:12:19 -0800 (PST) Message-ID: Date: Tue, 21 Feb 2023 05:12:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode Content-Language: en-US From: Dmitry Gutov To: Yuan Fu References: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> <8d2075c6-7d1e-81b6-ac17-c21bea65e377@yandex.ru> In-Reply-To: <8d2075c6-7d1e-81b6-ac17-c21bea65e377@yandex.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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.9 (-) On 06/02/2023 05:20, Dmitry Gutov wrote: > On 06/02/2023 03:03, Dmitry Gutov wrote: >> And for associations.rb, the query times are 0.004322s vs 1.083029s. > > Similarly, using tree-sitter-cli, > >   time tree-sitter query associations-query.scm associations.rb > > with a simple query also reports ~1.3s here. Looks like this got fixed in https://github.com/tree-sitter/tree-sitter/commit/0b817a609f7cd3d7309a81dbfe96287c6945a085, just a week ago. And further improved (to the point where the delay seems entirely gone) in https://github.com/tree-sitter/tree-sitter/pull/2085. Too bad it'll be a while until it makes in into popular distros. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 03:14:27 2023 Received: (at 61285) by debbugs.gnu.org; 21 Feb 2023 08:14:27 +0000 Received: from localhost ([127.0.0.1]:54448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUNn9-0007nB-Fq for submit@debbugs.gnu.org; Tue, 21 Feb 2023 03:14:27 -0500 Received: from mail-pj1-f48.google.com ([209.85.216.48]:52829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUNn5-0007mt-Dx for 61285@debbugs.gnu.org; Tue, 21 Feb 2023 03:14:26 -0500 Received: by mail-pj1-f48.google.com with SMTP id g14so3895470pjb.2 for <61285@debbugs.gnu.org>; Tue, 21 Feb 2023 00:14:23 -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=IvIbjN4TzXJ0iCFhACcXJA/nUfTmk+ncBCAre5ZR7DY=; b=eWaZAiWj2NLyxtMlbYaTb+6B145/ujsLV6qWNO1X2/9LtMLKSv8VFZ10lLmQju4qbJ CTSJEyzU5kJeRwPtrWPHrWX8AG/+3xhsnpdpErLHhjUEjCIVZCOgfhL/vhKKl+IAsOCE I1O6OdZFifg7AqRCqxPh3ShAQv0CQzBagLkXLrOH9LpypaOKbNo9fxtSOF/WrukSkrPs NbM1OKy+ciAZXpo2x2+ugnnmaQPxR+92q+pQcy/nnO1eu1jq6CF6ukIs38Fa2KhdQhT4 CxaV+Sbl/mPfJo2oLUcskGNpD3Ykqk5cchhBot7WdVGqoWgcUjO4a/DX6GgpcIJT0/67 l4cg== 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=IvIbjN4TzXJ0iCFhACcXJA/nUfTmk+ncBCAre5ZR7DY=; b=cC0+/D7NFeL8wwUY5Dfdl1bCEq4JqtESayajJE0og89jcbwLCRhW+ihpN+dC+qUTBY /hPmXnobgUCU3nSrqZfAPOVFZ2kP+27siheMzYqAVmlfJBWEc4E+ufTAMue6tB9XaY4p hYElSpxAobRMhJS6QIlbZ2S94GQeEVxe4zHZiE1GlqZXlXSo34jcydwYrZHWJgS5GDmG +J4pxYhdHhavHyDIpntTHrWPKIFzi/I6fC6bgx3E9TYu/gU7+62DEELMRMud8xQM4Prk TlxRVLuxPDJ0Tpxh4aJHcE0Fe4lkmpV5lN0CenuqxHmXl/z0m2VK0Pd6FD0sANeVMYjT 0KYA== X-Gm-Message-State: AO0yUKWnEzryzFNtEPHi+sOyn8bPctjrOQbJ9v+ddx4nRgr5wRvfPun2 2TUYLUExkz6JxwXY75A8ER4= X-Google-Smtp-Source: AK7set+7d1wHJ6X+dM/iJ0IA4CDlOMWJVCWRKTCq2JxZRqTYx4tFM2YOAGoikkzHwrKV+u6S0rTr1Q== X-Received: by 2002:a17:903:228d:b0:19b:33c0:4097 with SMTP id b13-20020a170903228d00b0019b33c04097mr3655083plh.27.1676967257265; Tue, 21 Feb 2023 00:14:17 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id t12-20020a170902b20c00b001993411d66bsm2836274plr.272.2023.02.21.00.14.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2023 00:14:16 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode From: Yuan Fu In-Reply-To: Date: Tue, 21 Feb 2023 00:14:03 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <38171F65-F1BF-4008-B155-1E842976D44D@gmail.com> References: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> <8d2075c6-7d1e-81b6-ac17-c21bea65e377@yandex.ru> To: Dmitry Gutov X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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 (-) > On Feb 20, 2023, at 7:12 PM, Dmitry Gutov wrote: >=20 > On 06/02/2023 05:20, Dmitry Gutov wrote: >> On 06/02/2023 03:03, Dmitry Gutov wrote: >>> And for associations.rb, the query times are 0.004322s vs 1.083029s. >> Similarly, using tree-sitter-cli, >> time tree-sitter query associations-query.scm associations.rb >> with a simple query also reports ~1.3s here. >=20 > Looks like this got fixed in = https://github.com/tree-sitter/tree-sitter/commit/0b817a609f7cd3d7309a81db= fe96287c6945a085, just a week ago. Great news! >=20 > And further improved (to the point where the delay seems entirely = gone) in https://github.com/tree-sitter/tree-sitter/pull/2085. Looks fantastic, this might render one of the reason for using the = =E2=80=9Cfast mode=E2=80=9D obsolete.=20 >=20 > Too bad it'll be a while until it makes in into popular distros. See you in Emacs 30 ;-) Yuan= From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 04:53:18 2023 Received: (at 61285) by debbugs.gnu.org; 21 Feb 2023 09:53:18 +0000 Received: from localhost ([127.0.0.1]:54555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUPKo-00025s-GW for submit@debbugs.gnu.org; Tue, 21 Feb 2023 04:53:18 -0500 Received: from mail-wm1-f43.google.com ([209.85.128.43]:52801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUPKl-00025d-QC for 61285@debbugs.gnu.org; Tue, 21 Feb 2023 04:53:17 -0500 Received: by mail-wm1-f43.google.com with SMTP id j3so845745wms.2 for <61285@debbugs.gnu.org>; Tue, 21 Feb 2023 01:53:15 -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=J075bsuznC7f0iZf+nspKVjnn5rb1y11cl3RLdVklJ8=; b=eebOB+L0Gd9FCkqv+pgwfqaokyEJMXqSEapw2ooWOdLeQC9MSUf7lpQV8BYUEYnDT9 PqLU9KoAP6dnmmygMbdMA8Zm2d1MVaXpHa/XuyiqLptTsg6m+uaBOjBCXOBNO8nllwFF SRth6C66NOp8dAht7qjSYMsiR5dSOWgZOuk8chx+1K6YaTTJ1lIhPmkRzNcgnkJXjecP TWXDusGaUAC+leWmw9ZhvfOt8Odbu0aw3kCHFAARct94e6AXsZy76yqZQhjv2Xcwk9N+ C9FN3oTMUggsALZ/wu7GUoB0CopXXDqgKfj0kOWBk1xICWZ80u+5PGJIT9kH+lAC1Qx8 hCoA== 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=J075bsuznC7f0iZf+nspKVjnn5rb1y11cl3RLdVklJ8=; b=fe9gu6cejMHK4cpJQpPBKltzRlJ/hbOvBcYBpKw5vAtqaXyPZot9gkEutaCewLGFv0 xQTIY2rWAUk2xKOrm96gBTxSMqH/sJkpADOCmcg/WShSLz1vRzJ8vba7fToWTUHaFBGI XwiWbXxwfMWK4nxjHYN9iwEesyF5A9fetl8dri9KmMA/ci5PKqAuSaobhFdEF9YE+vIv QRip7hZXFVFrD2jX1wlACbOLRuMDPR78Dl3xyb2Ry/81+GM6Qs69W2/mr9v9YVoOlp9N z/0s2UeRWQZf/u9vHnIgJwEkrple0gvS65gAHNVzP+oZz0SaI4BshxmvinyzBfMRtbgx stRg== X-Gm-Message-State: AO0yUKXUxQ3rcDpWtKBN6H+Yp8OZ7xjab8VQ+6RzUFPn/Z2XMmQb4hMO 8QfD7H6VGZYBLu8IBOagSSE= X-Google-Smtp-Source: AK7set+aHHSF5IDnbdd2mtmlDyuhIsS/3yPlHr+EqiuoTYMbVKu/umnSnmiEX0pId7ik+QWN03yf6w== X-Received: by 2002:a05:600c:511b:b0:3e2:1a01:3a7c with SMTP id o27-20020a05600c511b00b003e21a013a7cmr3319732wms.6.1676973189693; Tue, 21 Feb 2023 01:53:09 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z9-20020a5d4409000000b002c54737e908sm3925541wrq.91.2023.02.21.01.53.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 01:53:09 -0800 (PST) Message-ID: Date: Tue, 21 Feb 2023 11:53:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode Content-Language: en-US To: Yuan Fu References: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> <8d2075c6-7d1e-81b6-ac17-c21bea65e377@yandex.ru> <38171F65-F1BF-4008-B155-1E842976D44D@gmail.com> From: Dmitry Gutov In-Reply-To: <38171F65-F1BF-4008-B155-1E842976D44D@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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.9 (-) On 21/02/2023 10:14, Yuan Fu wrote: >> Too bad it'll be a while until it makes in into popular distros. > See you in Emacs 30 😉 I suppose we could also start bundling the latest libtree-sitter and/or offer a helper to compile the latest (recommended) version? It seems to be even easier to build than the grammars. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 19:37:35 2023 Received: (at 61285) by debbugs.gnu.org; 27 Feb 2023 00:37:35 +0000 Received: from localhost ([127.0.0.1]:45348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWRWJ-00067z-86 for submit@debbugs.gnu.org; Sun, 26 Feb 2023 19:37:35 -0500 Received: from mail-pj1-f45.google.com ([209.85.216.45]:42824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWRWI-00067n-CD for 61285@debbugs.gnu.org; Sun, 26 Feb 2023 19:37:34 -0500 Received: by mail-pj1-f45.google.com with SMTP id h17-20020a17090aea9100b0023739b10792so4602952pjz.1 for <61285@debbugs.gnu.org>; Sun, 26 Feb 2023 16:37:34 -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=Xi7H/H63IxuN6f2C9OTKr/UcvWS2G8dEfs+YYrgMHxg=; b=LEJWfMPxsq4f2zsdtII/OgHzZlLUYNowTJaFNEUPhlLwLyAY+5wl/RxfxM6saXfZNw Kbg3KYiX0cbcBcyb2krbySnEnoEAWLRLpapUl5OKVVbU9rDmmbmBymdNIdW0cpVkvuG4 aZ3LVVt8h0rS5NtIbct11QzdSHopAKtNG6knJxprXvqYYPlq38DfWFqZWAax+v/Uvou5 C3ksz0kPCcWCenWxlLrXUcZFk2WsECWEp78g73P5zATJUIRffAA9H3SDiGfTxzJIm/3X rvxQC4OCEUieoCtsQkJOaUYESNdteWXqN0zhZfaycoM7ZSE8Csr+zayNK4dAb884N7PH znEg== 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=Xi7H/H63IxuN6f2C9OTKr/UcvWS2G8dEfs+YYrgMHxg=; b=VE12IWmR5dylxHHFWCBPQ02Py8/whlUIynltNHlzRlOIoDsPs6SWGn/9FQ0jgSFmu4 GLQWgnxwiJ4c/I4UI0gIKbzJdF5xX4JC+6jJmBZgJ6ECjicWpnXvmQdONpXltp17/BG4 s0zCkHKRuZNQJVQ5KFgSyvhtQsxOmZyqyV8mykDHnBreIHV4rzWd5gkAWauwSVVD5O8u az2sPAvzuIl1X1oC+wI6XDODtMlhv/Q8KrxMTJRXWJyUiJk9ey4sM12AQo/BbRQFb5aN skeJGhymxr+0DeNA84ug8S7pG6BsHIxRXwVglQxOl46mdaIQbz3RyKMOQeZI52NdzzX2 wmiA== X-Gm-Message-State: AO0yUKVuemCr9HqIzPJuP2xKz1Hpq2uLlz6L9f8sd8kz0L909ao4QcQF qIpcm/xqYUUg7l+7d6AW3GqVuLnELL46aQ== X-Google-Smtp-Source: AK7set9uyrMDHUkjOF7HamHUSBv75tfm7/9iSg9/s4Nm9gDDYcj66CkrbokaCu+No99YFVq3+Gi05w== X-Received: by 2002:a05:6a20:3ca9:b0:cc:e0fb:a83f with SMTP id b41-20020a056a203ca900b000cce0fba83fmr5563117pzj.36.1677458248706; Sun, 26 Feb 2023 16:37:28 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id 196-20020a6300cd000000b004ecd14297f2sm2798052pga.10.2023.02.26.16.37.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Feb 2023 16:37:28 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: bug#61285: (Sometimes very) slow font-lock after %w in ruby-ts-mode From: Yuan Fu In-Reply-To: Date: Sun, 26 Feb 2023 16:37:17 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <17a29b2e-beb2-f246-fe1c-2c3503c1bfe6@yandex.ru> <2C6F83F0-DD84-4549-9D91-3D820188674D@gmail.com> <06cc9ece-ac9a-e9e7-df9d-0b10978379a4@yandex.ru> <8d2075c6-7d1e-81b6-ac17-c21bea65e377@yandex.ru> <38171F65-F1BF-4008-B155-1E842976D44D@gmail.com> To: Dmitry Gutov X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61285 Cc: 61285@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 (-) > On Feb 21, 2023, at 1:53 AM, Dmitry Gutov wrote: >=20 > On 21/02/2023 10:14, Yuan Fu wrote: >>> Too bad it'll be a while until it makes in into popular distros. >> See you in Emacs 30 =F0=9F=98=89 >=20 > I suppose we could also start bundling the latest libtree-sitter = and/or offer a helper to compile the latest (recommended) version? >=20 > It seems to be even easier to build than the grammars. There has been many discussions about bundling libtree-sitter, but the = decision is to not. Personally I think this new improvement is great, = but probably doesn=E2=80=99t justify including libtree-sitter. Yuan=