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#60953: The :match predicate with large regexp in tree-sitter font-lock seems inefficient Date: Thu, 2 Feb 2023 19:03:52 +0200 Message-ID: <88a57446-f89e-9b5e-5e8d-3c3b952ced41@yandex.ru> References: <7624dddc-4600-9a03-ac8b-d3c9e0ab618c@yandex.ru> <83pmb1emxi.fsf@gnu.org> <6f318afc-ca71-8b7e-c822-52e6635b5718@yandex.ru> <83sffxcfxw.fsf@gnu.org> <83pmb1cbg5.fsf@gnu.org> <2da844d3-ea31-289e-2821-aa174e365ffd@yandex.ru> <6784f9e7-844b-374d-2a1e-8a61cebe0d7e@yandex.ru> <83zga03yne.fsf@gnu.org> <373a575f-c683-1581-c3e6-502e9897fb04@yandex.ru> <83mt603vrc.fsf@gnu.org> <83e58a1b-2e4a-356a-36d8-c756ff105b62@yandex.ru> <83bkmf52va.fsf@gnu.org> <33cad4c1-4af5-37bb-05bc-79a4d9c1a700@yandex.ru> <83wn533lut.fsf@gnu.org> <19892f55-498e-1109-2229-2ddd984849a4@yandex.ru> <83tu073ksp.fsf@gnu.org> <83sffr2xq2.fsf@gnu.org> <30b047a9-dfe3-948a-a123-2e15221c239d@yandex.ru> <83tu05zeqe.fsf@gnu.org> <957c7e3e-830e-0a03-562f-fdddc6bd1c06@yandex.ru> <835yckzic7.fsf@gnu.org> <835yckxi29.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4716"; 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: casouri@gmail.com, 60953@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 02 18:05:26 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 1pNd1a-00013P-AR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Feb 2023 18:05:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNd1R-0004kP-2p; Thu, 02 Feb 2023 12:05:18 -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 1pNd1C-0004X2-Q1 for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 12:05:06 -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 1pNd1C-0004GE-Av for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 12:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pNd1B-0002d7-P4 for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 12:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Feb 2023 17:05: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.167535744310040 (code B ref 60953); Thu, 02 Feb 2023 17:05:01 +0000 Original-Received: (at 60953) by debbugs.gnu.org; 2 Feb 2023 17:04:03 +0000 Original-Received: from localhost ([127.0.0.1]:35645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNd0E-0002bs-WF for submit@debbugs.gnu.org; Thu, 02 Feb 2023 12:04:03 -0500 Original-Received: from mail-wm1-f44.google.com ([209.85.128.44]:38639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNd0C-0002bO-V1 for 60953@debbugs.gnu.org; Thu, 02 Feb 2023 12:04:01 -0500 Original-Received: by mail-wm1-f44.google.com with SMTP id f47-20020a05600c492f00b003dc584a7b7eso4200766wmp.3 for <60953@debbugs.gnu.org>; Thu, 02 Feb 2023 09:04:00 -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=6EDfbloG4eFvLuZ1T/jXnsvh1WWmfSIvdln4Hlp1TpY=; b=Q+zgY2RY/XGHuczXWaXY9SPWrdFq/7BZqzs/waQEo3CLBt3GZFazJOeQmwAanjH8F8 DVqu5Tbau7EyitE7QlRvvYxh7c0GdqRBX7Q2wGd5KZF6L5UzummHLRtiI7QV7YxR1Shw UlBxyB0E5fQIl/6TDneDq3TeRl86Wh5KQSCL8r+DWYAiX2+K7HMc6/ug1ysjZEeU+1x0 LpxsPvLMHrLalU3FIBK3U78ZRD8h06eIb8EqmPUUjEaBD9NfuePu1pJY8k87i1u7lkwB bIi7k+Vt2xsK8A5xzFER0AyJ9B3GqVOt9tYVQ7+7glFag8yYKvbA8fQuMUC68F4+JOlu pOBA== 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=6EDfbloG4eFvLuZ1T/jXnsvh1WWmfSIvdln4Hlp1TpY=; b=hhMrHGX3GpHbYgTAliJWyqbqyOMryvC/YHdAwFBqQF4trqQ+8m9JNe0k/JcCyf2nLm uE8pB7aIay11bkuDi/JyDIY1Ox58oBEcLp/v9fLdW3WofjUUPCQEcks407wuILY/VpTm K4ME1iljBRUuYgshbkmOzXtHnBAlsUWhZBHl2F3SyfTeBobocmnZdBVCRkzcNBjZh9gp 2oQl4ZBdU8kcYE5A4VWDuGas/QeMo56yidyLleFOoUeiY/QbvGN5i8fBlLfxYPNylB1A PNCilv1SByVAF06EfMFFC9lsqNkD9h8uygBmVD/s4n/6RnEtB4iiIQ87/RnVSP2YSAu+ w4gw== X-Gm-Message-State: AO0yUKXuO50ZDUDZSku67SiWmeO14B8MY/ZM9lYdRI8Crqx2iKo0MrKC n92NgOPCPoxEhhh1LMjjO/E= X-Google-Smtp-Source: AK7set+CaZy115fh3NV4NfCEkgTcaIgIXfmaUl4jyCNq32tPZpcGtgqqBFBy4TTR6VVyOH9rbE/4nQ== X-Received: by 2002:a05:600c:3b0f:b0:3dc:489e:1867 with SMTP id m15-20020a05600c3b0f00b003dc489e1867mr2209699wms.36.1675357434912; Thu, 02 Feb 2023 09:03:54 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id c7-20020a05600c0ac700b003d1d5a83b2esm5190636wmr.35.2023.02.02.09.03.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Feb 2023 09:03:54 -0800 (PST) Content-Language: en-US In-Reply-To: <835yckxi29.fsf@gnu.org> 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:254670 Archived-At: On 02/02/2023 16:23, Eli Zaretskii wrote: >> Date: Thu, 2 Feb 2023 14:12:54 +0200 >> Cc:casouri@gmail.com,60953@debbugs.gnu.org >> From: Dmitry Gutov >> >> Please take a look at this additional patch on top of the other one. It >> is ok? >> >> I just remembered that if we don't want to auto-anchor the regexp, then >> 'looking-at' is not the appropriate semantic. So this switches to >> 'search_buffer'. > One gotcha: fast_looking_at returns the length of the match, whereas > search_buffer returns the buffer position where it matched. Shouldn't > this need a different handling of the return value? Probably not: we just need to know whether it matched or not. And when it did not, it returns 0, right? So the same check should work.