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#59738: c-ts-mode is slow with large buffers. Date: Wed, 07 Dec 2022 19:23:38 +0200 Message-ID: <83edtb3z6t.fsf@gnu.org> References: <87E351E0-2EE2-434A-9609-86506D2F263D@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16265"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 59738@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 07 18:24:16 2022 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 1p2y9Y-00041S-42 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Dec 2022 18:24:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2y9L-0000Nr-TI; Wed, 07 Dec 2022 12:24:03 -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 1p2y9L-0000NX-7z for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 12:24: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 1p2y9L-0003Fz-01 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 12:24:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2y9K-0002xQ-LS for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 12:24: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: Wed, 07 Dec 2022 17:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59738 X-GNU-PR-Package: emacs Original-Received: via spool by 59738-submit@debbugs.gnu.org id=B59738.167043384211362 (code B ref 59738); Wed, 07 Dec 2022 17:24:02 +0000 Original-Received: (at 59738) by debbugs.gnu.org; 7 Dec 2022 17:24:02 +0000 Original-Received: from localhost ([127.0.0.1]:51207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2y9J-0002x5-0G for submit@debbugs.gnu.org; Wed, 07 Dec 2022 12:24:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2y9D-0002ww-TX for 59738@debbugs.gnu.org; Wed, 07 Dec 2022 12:23:59 -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 1p2y98-0003Es-DO; Wed, 07 Dec 2022 12:23:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=d8AcsnGmHd1gg1RGFSmF6SxKqUjPWhQUX0xj+Oac9nE=; b=aMCYDcL4G9rP 8B03xfTy4DdIsgPUqLpp9eueI4+2RAZwZcAFT4ohOrOi2rOstTWvYJ3rLMzdJlewJrlKKW/Z2kmnu nkFiYb3wuy10ZzfCNmRwc+JZ3HW3kM3GrMr9uMwee+aalBw4afCLbORjxj/KycVfpp16VSUPC9MGX 4nCfoE4l+/hQPbE/sAH37iO9WUatOpdJ46MCs0FdBrwL8ctI0q1/gzLq4/37zU+f4tJpLPefYVasZ 2I/30WVu5C+S2LMHu5FQGGa7p7HfJylRn3Z1pfFOFcPJoALCf5cV0yqwtabH8siygXkj7jqkxB9Mz P6GervqaFJ5zKy6162I45g==; 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 1p2y97-00041h-T1; Wed, 07 Dec 2022 12:23:50 -0500 In-Reply-To: <87E351E0-2EE2-434A-9609-86506D2F263D@gmail.com> (message from Yuan Fu on Tue, 6 Dec 2022 20:56:13 -0800) 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:250202 Archived-At: > Cc: 59738@debbugs.gnu.org > From: Yuan Fu > Date: Tue, 6 Dec 2022 20:56:13 -0800 > > > Alan Mackenzie writes: > > > Hello, Emacs. > > > > In an up to date (2022-11-30) master started as $ emacs --no-desktop: > > > > The file .../drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_sh_mask.h > > in the Linux source tree is 6.8 MB big, consisting of a large number of > > #defines and comments, but nothing else. > > > > To scroll through it in c-ts-mode takes a little over 26 minutes on my > > system. By comparison, in C Mode it takes 31 seconds. There would > > appear to be a need for some optimisation in c-ts-mode, here. > >[...] > Ah, the lovely packet-rrc.c file. No, this is a different file, dce_12_0_sh_mask.h. It is a header file which only has preprocessor #define lines. I'm puzzled why this presents such a great difficulty for tree-sitter. Could you take a look what happens with that file? > We had some discussion of it in > bug#59415, basically it contains some syntax that screws tree-sitter up. > The block initialization you see makes tree-sitter into erroneously > generating a very tall tree: it recognizes all the opening bracket and > ignores (almost) all the closing brackets. That causes operations on the > tree to be much much slower than it normally is. Right, but with a long series of #define lines there should be no parse tree at all...