From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Mon, 15 Aug 2022 10:10:36 +0800 Message-ID: <87pmh2z277.fsf@localhost> References: <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> <83wnbckp0q.fsf@gnu.org> <8e884ebe-2d2e-d599-15c3-a5cfe5e6b295@yandex.ru> <83o7wnl7ok.fsf@gnu.org> <036414cc-c711-efaf-ed5b-f8ccfaca0604@yandex.ru> <5900f20836753183a6ac@heytings.org> <5c22e38a-5dcd-860e-28a0-b4a5ede6a21b@yandex.ru> <877d3awb92.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Gregory Heytings , Eli Zaretskii , Dmitry Gutov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 15 04:10:12 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 1oNPYR-0003DQ-Kl for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 04:10:11 +0200 Original-Received: from localhost ([::1]:45350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNPYQ-0003VG-9f for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 22:10:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNPYI-0003Us-E0 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 22:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNPYI-0005dH-5f for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 22:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNPYI-0003ax-0I for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 22:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Aug 2022 02:10: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.166052938713795 (code B ref 56682); Mon, 15 Aug 2022 02:10:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 15 Aug 2022 02:09:47 +0000 Original-Received: from localhost ([127.0.0.1]:40145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNPY0-0003aN-7v for submit@debbugs.gnu.org; Sun, 14 Aug 2022 22:09:47 -0400 Original-Received: from mail-pj1-f43.google.com ([209.85.216.43]:39831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNPXx-0003a6-1U for 56682@debbugs.gnu.org; Sun, 14 Aug 2022 22:09:43 -0400 Original-Received: by mail-pj1-f43.google.com with SMTP id h21-20020a17090aa89500b001f31a61b91dso13241997pjq.4 for <56682@debbugs.gnu.org>; Sun, 14 Aug 2022 19:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=+ViMvZxA90PiiNqgvAk0w8p0hwXUrDo6hGJKdnWwV6g=; b=f+6TbeyMRpZzXIXfMkPe9UUVCgAtEW+SC0XQHE+MbXUD4S5rRvXl5iFvjnD3jUiuLm Cm2vcjLbHpxVB6F8qJvIgz1ncX1DqdlpSa71T9nAk/a4sktXjQcmfXQ9xL4lT3/q3ZlS Ts/G5iZY6j1XZI7lvb8GQHhR8IHtBxzxifxu1eq+wvWRvnjuY0AuiT8kLjIxjS7tlzFc wrrNj2nH34u+Z+uUASh0QD4anIp0rkcQDKIJF8SqnnlACeTumvnltpOyoNLCDX93xUXM 9Mj0psHOu8pmWCYD2FkF1UWGdIH3zDi7/zj2khf9AIcccQvUVOjCPTp95xh9hl+6rD8S h6kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=+ViMvZxA90PiiNqgvAk0w8p0hwXUrDo6hGJKdnWwV6g=; b=JDafrXI+JTUtlkVyJ6FGpYciI4awgP/Hnhy3P3YrfCK3fWQagfffvLS1Xc5SO+BzOK RYtYzUtcU9zF9REHwML7NnXgKwWOJgaWX0qGWU+24r36EBLwhm5C3apadzqKBIse5THP 237GyF4vxI5MqH6PXlgsqdHB4OdodRiM6gyHmjRZjZ0FaISrf/aJmvqbc7cCSU7OiFig g3TZa3jGA/K8+pPgRNia1xAU6PA9JRqJ6sKHoICTFgm9KlIo+ASLN9vq0UIPkBo5UMDk O0lWu+NoTeeIJoZenbgq0WqOMIoC5qMKhf+isHe6dIo/MWI5gQrg0eBgs1sBbw6G5OGM vggw== X-Gm-Message-State: ACgBeo05x36Eawy1w0PpfmDgavpAZGfD1oRnieiMRXxpL5vCh07qEmgB gMtvGUn0KDrZvbPzJGODE5A= X-Google-Smtp-Source: AA6agR6z7pnnuuOxlGQRe9I13BvJwFfjfnjSi/6kH43TSpCvQmZLe+hsPkFWOp65v4qan7sNnmvpuA== X-Received: by 2002:a17:903:41cc:b0:16e:d522:6b8e with SMTP id u12-20020a17090341cc00b0016ed5226b8emr14958581ple.62.1660529374610; Sun, 14 Aug 2022 19:09:34 -0700 (PDT) Original-Received: from localhost ([115.154.175.57]) by smtp.gmail.com with ESMTPSA id b190-20020a621bc7000000b0052d87b76d12sm5675786pfb.68.2022.08.14.19.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Aug 2022 19:09:33 -0700 (PDT) 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:239714 Archived-At: Stefan Monnier writes: > Ihor Radchenko [2022-08-15 09:23:21] wrote: >> Dmitry Gutov writes: >>> Do you have examples of such modes? >>> Calling 'widen' inside font-lock-keywords is a bug, and the bugs should >>> be fixed at the source. >> widen inside save-restriction is likely used by Org mode (or will be). > > Why? Because Org syntax is context-dependent, and we may need to look backwards to determine the "container" element before knowing what the element at point is. >> This is needed by Org parser to determine the syntax element at point. > > But font-lock widens before using Org-mode's `font-lock-keywords`, so > there should be no need for Org-mode to widen in that case. Yes, but Org parser is not written explicitly for font-locking purposes. org-element-at-point knows nothing about buffer restriction upon calling and thus has to widen to ensure correctness. > PS: Not sure if Org-mode qualifies as a mode that is likely to suffer > from the kinds of long-lines or large-file problems that Gregory has > tried to tackle, tho. I've never seen an Org file with lines >10kB nor > an Org file larger than 10MB. I have seen very long lines in Org. Specifically, in source block output. (http query) My notes.org file is over 20Mb. Even larger files can be auto-generated by https://gitlab.com/publicvoit/Memacs -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92