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#60953: The :match predicate with large regexp in tree-sitter font-lock seems inefficient Date: Thu, 26 Jan 2023 08:50:04 +0200 Message-ID: <838rhpg57n.fsf@gnu.org> References: <7624dddc-4600-9a03-ac8b-d3c9e0ab618c@yandex.ru> <04729838-b7d4-8a08-2b71-12536a28aebb@yandex.ru> <83wn5ag4nc.fsf@gnu.org> <01b5d074-fb12-6b1f-cbfb-5e759833b854@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32740"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 60953@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 26 07:50:16 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 1pKw5P-0008Kp-Pi for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Jan 2023 07:50:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKw5D-0001H0-VV; Thu, 26 Jan 2023 01:50: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 1pKw5C-0001G9-HS for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 01:50:02 -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 1pKw5C-0003E0-6W for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 01:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pKw5C-0004B6-0N for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 01:50: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, 26 Jan 2023 06:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60953 X-GNU-PR-Package: emacs Original-Received: via spool by 60953-submit@debbugs.gnu.org id=B60953.167471579916046 (code B ref 60953); Thu, 26 Jan 2023 06:50:01 +0000 Original-Received: (at 60953) by debbugs.gnu.org; 26 Jan 2023 06:49:59 +0000 Original-Received: from localhost ([127.0.0.1]:60447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKw58-0004Ai-TA for submit@debbugs.gnu.org; Thu, 26 Jan 2023 01:49:59 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKw55-0004AR-JF for 60953@debbugs.gnu.org; Thu, 26 Jan 2023 01:49:58 -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 1pKw50-0003By-2j; Thu, 26 Jan 2023 01:49: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=z5bFN+3gETqH79q/fPgWogGuTp+jfDDTMEHztAodpag=; b=ba1XRKRDkBft WK7qxmGHiWScoRGZvSEq7teRE5Ie1OieybQtZSq5/130KM+jXZGCfQg86srVwFbug3LV9jnz9KDUd lcBp9OA3xYzltRhopRBx5LISAYGYszRaf6rvsIrqOEcSyR69EEt0vQ0FumciXtozEUYnpm0NCcBEr UIRZCZO3kTD9p0e4CUHdm141iY35We5s9CujOeop0SzbCq21FB3wTLF5JM30ZMRx4CXpAfG3NP9dD rcRRom0icQpYssdQHuHYmDjZqKokI/WUbjJ4g2bQXwixZ03fZttj6nkupmyCxAq63uylPn44SvJQE 1ft0kvAKI9RN1eDVRZD8qQ==; 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 1pKw4z-0004hS-Co; Thu, 26 Jan 2023 01:49:49 -0500 In-Reply-To: <01b5d074-fb12-6b1f-cbfb-5e759833b854@yandex.ru> (message from Dmitry Gutov on Thu, 26 Jan 2023 01:21:08 +0200) 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:254172 Archived-At: > Date: Thu, 26 Jan 2023 01:21:08 +0200 > Cc: casouri@gmail.com, 60953@debbugs.gnu.org > From: Dmitry Gutov > > Thank you. Unfortunately, the performance improvement from this patch is > still fairly negligible. This is quite strange, since all of the approaches basically use the same primitives under the hood. Perhaps the reason for the slowness is that the code which computes the text span of a node is slow? Otherwise, I must be missing something here, since the rest of the code on the C level is basically the same, give or take some wrappers that should not change the overall picture. Yuan, do you have some insights here? > Switching to using :pred with function (like I did in commit > d94dc606a0934) which still uses buffer-substring inside is significantly > faster. If the performance issue is fixed, then the only aspect that we should perhaps try to improve is consing. Consing a string each time you need to fontify increases the GC pressure, so if there's a good way of avoiding that without performance degradation, we should take it. Is it possible to use your :pred technique in a way that doesn't need to produce strings from buffer text?