From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71345: Feature: unleash font-lock's secret weapon; handle Qfontified = non-nil Date: Tue, 04 Jun 2024 10:15:59 -0400 Message-ID: References: <8A929E16-AF10-4D2B-AD71-AEAD4435F016@gmail.com> <1F2B8726-7594-494F-AB9D-08C48B7BCC43@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40516"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dmitry@gutov.dev, 71345@debbugs.gnu.org To: JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 04 16:17:20 2024 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 1sEUyU-000ACV-Gz for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jun 2024 16:17:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEUy6-0000Yy-O7; Tue, 04 Jun 2024 10:16:54 -0400 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 1sEUy2-0000YH-CX for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 10:16:51 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEUy1-00066Z-4J for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 10:16:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sEUyE-0007PR-8h for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 10:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jun 2024 14:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71345 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: Dmitry Gutov , bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171751059028388 (code B ref -1); Tue, 04 Jun 2024 14:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jun 2024 14:16:30 +0000 Original-Received: from localhost ([127.0.0.1]:54793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEUxh-0007Nl-OA for submit@debbugs.gnu.org; Tue, 04 Jun 2024 10:16:30 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:53886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEUxe-0007NT-BW for submit@debbugs.gnu.org; Tue, 04 Jun 2024 10:16:28 -0400 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 1sEUxO-0000PQ-5q for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 10:16:12 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEUxK-00060S-VL for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 10:16:09 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5F966100064; Tue, 4 Jun 2024 10:16:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1717510559; bh=uopWs/2bP5I48sh/0SjvJesKP/kzYxlLCHrqKjWJF8A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=G5Yl9l1PolH9NtLixag9/qOVErQJJo0FgAxV1U9cgOKi+e93MqqFQHyXfIwUTxOTG CoCDZlUG3CtFHkijbvpRJaAVDqiuE6K7n/aVqNg8D0H9R2foUOP5nZCODijUjNyasM hgA0pomSUOhFLsja4Ean+r0vpFty4HJQ26t4+yP9IqncRX3jIRsBa1PY2zR7fzvOOs BfkV15iS5IIF9Pef4klkBiXWDxBe4MUMV1H8FDPBhF0cmzK0UIWDslCXovmk0IMr4S hWBrVZXyQHzzfws20zcfj/WiiQkW7SozU99BlSXF/s1WC1W7uVSgKfvRFZKP+b97ib T8O6CnecthfDA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B29CD100042; Tue, 4 Jun 2024 10:15:59 -0400 (EDT) Original-Received: from alfajor (mtrlpq42zf4-70-26-189-134.dsl.bell.ca [70.26.189.134]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9DFA5120672; Tue, 4 Jun 2024 10:15:59 -0400 (EDT) In-Reply-To: (JD Smith's message of "Tue, 4 Jun 2024 08:08:40 -0400") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:286539 Archived-At: >>> That starts to sound like a lot of property slinging, which might even >>> dominate the work done. >> Indeed, this amount of work could become significant. It's my main >> worry, but I don't have a clear feel for how serious it would be >> in practice. > In my situation, the most likely scenario is that fontified=nil is noticed > during redisplay when there is a fairly large stretch of already-fontified > property having the same value. So jit-lock-fontify-now will quickly find > a nice large chunk to call my FONTIFICATION-FUNCTION=F-F with. > > Since jit-lock-after-change will likely clear away already-fontified and set > fontified=nil, a single additional F-F on top of jit-lock-function will > probably be very well handled. A good question is how it would scale with > more functions all operating in the same region. One idea is to rig up > a test file, do some fake jit-lock-flushing on it, and check performance of > just subtracting/searching/dividing the already-fontified property as you > add more (fake) F-F's. For me, jit-lock-fontify-now of a 2500 char chunk > in a heavy treesitter buffer is in the 2-5ms range. Individual F-F's could > be much lighter weight. I must say that I can't follow you. I suspect we're not talking about quite the same thing. Could you clarify what is the costs you imagine could be significant? What you compare it to? You seem to be comparing "a single big jit-lock backend" vs "several jit-lock backends", which is a completely different worry from mine. Splitting a backend into several backends comes with many more issues (such as the issue of fighting over which one controls which properties, or removing internal dependencies such that none of them needs to look at the properties set by the others, ...) but that seems largely orthogonal to the question at hand: if you want to be able to refresh the position-dependent highlighting separately from the rest of the highlighting you need that position-dependent highlighting to be independent anyway (e.g. you need to be able to remove it without affecting the position-independent highlighting). > But things like `text-property-any' will be quickly defeated by the > combinatorics of a large F-F set. `text-property-any` only tests `eq`ness so it works just as quickly with a property made up of a million-element list as with a property made of a boolean. IOW, I again can't follow you. > So here's an idea. You could invert the logic, and have a set of > `fontified-pending' properties which jit-lock-flush adds to as it sets > fontified=nil, Yes, of course, we could use the complement set. Stefan