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#56682: Fix the long lines font locking related slowdowns Date: Sun, 31 Jul 2022 17:41:13 -0400 Message-ID: References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> 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="30286"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 31 23:42:10 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 1oIGhN-0007iJ-Km for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 23:42:09 +0200 Original-Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIGhM-0006QC-Iv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 17:42:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIGhG-0006Py-3m for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 17:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIGhF-0001Mq-RL for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 17:42:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIGhF-0006Fi-Jz for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 17:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2022 21:42: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.165930369223993 (code B ref 56682); Sun, 31 Jul 2022 21:42:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 21:41:32 +0000 Original-Received: from localhost ([127.0.0.1]:38707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIGgm-0006Eu-D0 for submit@debbugs.gnu.org; Sun, 31 Jul 2022 17:41:32 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIGgg-0006Ea-CB for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 17:41:30 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BE31F80722; Sun, 31 Jul 2022 17:41:19 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 74EED80065; Sun, 31 Jul 2022 17:41:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1659303678; bh=B6n3y2xm32Zog/EYEYfy3yqjeAGa1kO3GoScOL9YlFg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hj51JcoAid6PDs1LnEa3URKbiNOgqDxQjdnLgjMIusXgQ1GGp8DlnuIlkFHBG9AyU E1d/1Y4sEMHVYicYuSl1ltrXBaZYMnOA7/r36YAQ77nrNmGUEcmrR8bwXcphinfr0O ZDBglRKwh1JPGgxZUpBOVLDQYkkDZl6h4t8sEJxL5dfOybmDscO9m2qRJ4zoy2jShD W1+AFIRPvt0dAstKF1XljX8AEu+qywPzVwxUZkKm5c6toa7NGqsSGxLSt+C5x4cIns NewxtV/AtAco46CY7BymnpqKTC9uZxcGZkBwsRQbqM8b3mciQaK7eWqSxFQ1qwl1hd t3InzbwWCcjBA== Original-Received: from milanesa (dyn.144-85-174-155.dsl.vtx.ch [144.85.174.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ABE321203F4; Sun, 31 Jul 2022 17:41:17 -0400 (EDT) In-Reply-To: <8c7321f2f388e5343475@heytings.org> (Gregory Heytings's message of "Sun, 31 Jul 2022 10:50:18 +0000") 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:238366 Archived-At: Gregory Heytings [2022-07-31 10:50:18] wrote: >> Emacs is not in the business of preventing people from shooting themselves >> in the foot. If we need this narrowing to be enforced because Emacs would >> otherwise crash, then it's OK, but if not, then we *should* provide a way >> to undo it. > And how do you define "crash"? Core dump. > Is Emacs becoming unresponsive because an operation takes say two > minutes to complete and cannot be interrupted a "crash"? Or is > a "crash" only a segfault? Try `M-: (use-global-map (make-keymap)) RET` Should we prevent users from doing that? Let's focus on making it easy to make it work well, rather than making it impossible to make it work poorly. >>> BTW, my tests show that syntax-ppss can be rather slow, when the file is >>> large enough (say 1 GB). >> No doubt. But it's no slower with long lines than with short lines. > > Yes, I wasn't clear enough, I should have written "when the file is large > enough (say 1 GB), even without long lines". > > But you didn't answer my question: is it not possible to design a version of > syntax-ppss that would approximate, with some heuristics, what syntax-ppss > does, but on a smaller chunk of the buffer? The answer is basically "no" but even before getting there, I have to remind the reader that it hasn't really been requested. In order to know if POS is within a string (which is one of the main uses of `syntax-ppss`), you basically need to know if there's an odd or even number of quotes before POS, which fundamentally needs to look at all the chars between POS and BOB. Of course we use a cache to try and avoid looking at them over and over again, but the cache can't be of any use the first time around. Stefan