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: Thu, 08 Dec 2022 22:37:05 +0200 Message-ID: <83fsdp1vke.fsf@gnu.org> References: <87E351E0-2EE2-434A-9609-86506D2F263D@gmail.com> <83edtb3z6t.fsf@gnu.org> <3A956C88-F81D-4DED-B020-178291D405D9@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27281"; 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 Thu Dec 08 21:38:23 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 1p3New-0006qk-MK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 21:38:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3Nee-0003TJ-NZ; Thu, 08 Dec 2022 15:38: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 1p3Ned-0003RN-AT for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 15:38: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 1p3Ned-00037v-2p for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 15:38:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3Nec-0003RO-FL for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 15:38: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: Thu, 08 Dec 2022 20:38: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.167053184313218 (code B ref 59738); Thu, 08 Dec 2022 20:38:02 +0000 Original-Received: (at 59738) by debbugs.gnu.org; 8 Dec 2022 20:37:23 +0000 Original-Received: from localhost ([127.0.0.1]:58969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Ndy-0003R8-N7 for submit@debbugs.gnu.org; Thu, 08 Dec 2022 15:37:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Ndw-0003R2-MM for 59738@debbugs.gnu.org; Thu, 08 Dec 2022 15:37:21 -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 1p3Ndq-00032j-N7; Thu, 08 Dec 2022 15:37:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1aUYvV3+DWis+794xOky6QhZ9CaWdCbXz05n3pk5qHI=; b=KMyMUU//ZuaDPcBtAKGP F3OYxnkz9qh5gQ0Af5bYb9BNhhMOoNPDQgdYc9Wlb4giAiLYEkDQZm6bacZ9r8cFDMOg+nSsFdQ35 aPRQm1JookQRjHLAKfDSf0H7EmbbyFd6oqzDsO806EdSJMpNz/mhIJjZd2hX96tHcu3p9SAqwBPoi trLQpYi40SQS6RnEvXRej8mvvL4Q9bqlAQw44W0Q1Z+168cDoImOTOYJ8GEvtmhC1LRkzDWiCZAHf f7lny7yBpPcg5rKYAKuAIWWGH6/cEVSypZZi8BAfMtWblCluh+ujYG0lTKfKaEN41Fm4W0DSpDnpV h2dTdjJdaiBR1w==; 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 1p3Ndq-0005vW-4e; Thu, 08 Dec 2022 15:37:14 -0500 In-Reply-To: <3A956C88-F81D-4DED-B020-178291D405D9@gmail.com> (message from Yuan Fu on Wed, 7 Dec 2022 16:40:15 -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:250336 Archived-At: > From: Yuan Fu > Date: Wed, 7 Dec 2022 16:40:15 -0800 > Cc: Alan Mackenzie , > 59738@debbugs.gnu.org > > > Right, but with a long series of #define lines there should be no > > parse tree at all… > > Ok, I think I know why. At the beginning of the file there is this line > > #ifndef _dce_12_0_SH_MASK_HEADER > > So it’s parsed into a preproc_ifdef node, which contains every #define directive in the file as its immediate child. Now you have this node with a tons of immediate children. And querying this node in font-lock is very slow, even with a limited range. I think for the query result to be accurate, tree-sitter has to query the whole node without considering the range, then throw away matches that are not in the range. > > Anyway, I activated my backup backup plan, which goes down the parse tree to find a sufficiently small node to query. Now scrolling the header file is fast as other files. Thanks, now c-ts-mode is twice as fast as c-mode with that file. Great job!