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#56682: Fix the long lines font locking related slowdowns Date: Mon, 15 Aug 2022 23:40:35 +0300 Message-ID: <7340244f-7343-64de-a0fe-c274ca6544b6@yandex.ru> References: <92da07bd02a6cc861e1a@heytings.org> <837d3lzv8n.fsf@gnu.org> <2c8d6755-cfe2-6559-3fde-3fa30ffb411e@yandex.ru> <83mtcgy44k.fsf@gnu.org> <83k07jx5jn.fsf@gnu.org> <866e510d-a060-7daa-d002-97861d056fa7@yandex.ru> <1144021660321893@iva5-64778ce1ba26.qloud-c.yandex.net> <12348081660379417@sas2-a098efd00d24.qloud-c.yandex.net> <66bbbb95983414e79637@heytings.org> <83wnb9hadb.fsf@gnu.org> <395454dd-7238-c5d0-e924-2f65a186baa7@yandex.ru> <83r11hh4pm.fsf@gnu.org> <3a1232a17b7bc39eb451@heytings.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="33812"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: 56682@debbugs.gnu.org, Gregory Heytings , Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 15 22:41:11 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 1oNgtb-0008ZX-Aa for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 22:41:11 +0200 Original-Received: from localhost ([::1]:41470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNgtZ-0005tk-WC for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 16:41:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNgtS-0005tK-AG for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 16:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNgtS-0004Z3-1o for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 16:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNgtR-0006cS-SP for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 16:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Aug 2022 20:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.166059604725416 (code B ref 56682); Mon, 15 Aug 2022 20:41:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 15 Aug 2022 20:40:47 +0000 Original-Received: from localhost ([127.0.0.1]:44185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNgtC-0006br-Ux for submit@debbugs.gnu.org; Mon, 15 Aug 2022 16:40:47 -0400 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:40608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNgt9-0006bc-Hb for 56682@debbugs.gnu.org; Mon, 15 Aug 2022 16:40:45 -0400 Original-Received: by mail-wm1-f42.google.com with SMTP id h204-20020a1c21d5000000b003a5b467c3abso7766866wmh.5 for <56682@debbugs.gnu.org>; Mon, 15 Aug 2022 13:40:43 -0700 (PDT) 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; bh=/SVYN0UUe9CHC7VdRCSLufWRI1z81otYwnJbay7aZQI=; b=jloeLKOao/a7bi+MES9h63QbPmbcIBR06SjKrgToQ44Rsaz7Mu2RAza97bCME35nej gSgRm9j8hUy+CMa+400nIbZzAgmdS3QxTmyjv0rn18Stt1jXi5yLklFKQY7oFcAUob+q S31mgRI71fWWvUguI/s3uviIuD7rnipGj+KcJIGM49rP7FIZsq6Gj+/b8AvCfv6IXXtB yxuFOt+Y0QYsNhdQbc+WsS32S8va7LdK/N/LqvEWWQZpFtdD53kFV01E+udpXIDA1Ouk pmsbwXRHj6fn+xwFHDjhYWj9c0G2E5oRC4vDHAWT1DFhqAA/FDyos5c2aUrhLaFn7ptE gE5g== 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; bh=/SVYN0UUe9CHC7VdRCSLufWRI1z81otYwnJbay7aZQI=; b=Oh+QmPzbFLMuECCnlQTgoz/7t5Xv/1sFKhB+dABvpISZm9TpddPUlVvkmTs2npd5XY ZO/HaYT5bPvH5xp34r3CLpnb0XeLIepl4J1weaT3Tbt2kTvuacGcVs2QAz1v4sncVNjl abu9xKHUn6ADlFtcksYcNeZ4HOhqVxErrbHvHmiIPzEnyXkY5fslOq6XJCXVYbFUbaiA qBKK2bWRGPcBLhVxbcuihL9GzQYP65kZDtYj0f1J8erBKB2egqo+N8X0PuurowOwHPip 0tDom8os02WqPrirQJ/FUm6RXpBHBzuUMoysjQgGbPq8Tq1edN0Ubl+qxfHCNdt4/AqU qhXg== X-Gm-Message-State: ACgBeo1DhnzAYOLTu2rwSI/ZzZ4+T0ZzlLVYliXohaaFFB2oR/pVkujM 75CFfZdjGVuHABG1PQ4/5Gw= X-Google-Smtp-Source: AA6agR5SkNhWXOZ33V1NfxQ83gxR22EQEGDKbTDybnPKOvzx57f2z0ly1ueaxTHqQh0Vn6l4fgMgJA== X-Received: by 2002:a05:600c:6009:b0:3a5:b069:5d34 with SMTP id az9-20020a05600c600900b003a5b0695d34mr11133379wmb.115.1660596037538; Mon, 15 Aug 2022 13:40:37 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id r22-20020a05600c35d600b003a5ffec0b91sm2619484wmq.30.2022.08.15.13.40.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 13:40:37 -0700 (PDT) Content-Language: en-US In-Reply-To: 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" Xref: news.gmane.io gmane.emacs.bugs:239838 Archived-At: On 15.08.2022 23:25, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Dmitry Gutov [2022-08-15 22:54:30] wrote: >> On 15.08.2022 22:25, Gregory Heytings wrote: >>>> I've never seen fontification-functions contain anything but >>>> jit-lock-function, >>>> >>> You did not read the thread carefully enough: two weeks ago it was >>> mentioned that fontification-functions has at least two other users: in >>> ELPA multi-mode.el sets fontification-functions to multi-fontify, and in >>> MELPA poly-lock.el sets fontification-functions to poly-lock-function. >> >> Okay. But those should be easily adapted to use jit-lock-functions instead. > > IIUC they use `fontification-functions` to wrap the "select the current > major mode" operation around the call to `jit-lock-function` so that > each submode can use its own set of jit-lock clients. > > It's harder to hook into `jit-lock-functions` to do that because you > need to detect when `jit-lock-functions` is modified. Do they detect when fontification-functions are modified? Sounds like just as much of a rare occurrence. > AFAICT mmm-mode does not try to do that at all. It does the wrapping through custom font-lock-fontify-region-function and syntax-propertize-function. The major mode specific values are saved after the major mode is called. Any subsequent modifications are just ignored. >> They'll get all the corresponding performance improvements (just-in-time >> fontification) as a bonus. > > Not sure what you mean by that. `fontification-functions` is already > called "just-in-time" (and those packages don't re-implement jit-lock on > their own, they just wrap themselves around jit-lock). Okay then. Sounds like somewhere in there there's a duplication of design still. But also: if they go on to call jit-lock anyway, then they would go through whatever application of narrowing that we put in there. Be that in font-lock-fontify-region, or in jit-lock-function.