From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Sun, 31 Jul 2022 22:06:01 +0000 Message-ID: <8c7321f2f36494299e61@heytings.org> References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lnZl2UCHWW" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25822"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 01 00:07:36 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 1oIH60-0006VC-5k for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Aug 2022 00:07:36 +0200 Original-Received: from localhost ([::1]:43026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIH5z-0002xY-9F for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 18:07:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIH5S-0002wb-Ec for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:07:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIH5S-0005Hq-6K for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIH5S-0006um-1f for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2022 22:07:02 +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.165930517126515 (code B ref 56682); Sun, 31 Jul 2022 22:07:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 22:06:11 +0000 Original-Received: from localhost ([127.0.0.1]:38726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIH4c-0006tb-MW for submit@debbugs.gnu.org; Sun, 31 Jul 2022 18:06:11 -0400 Original-Received: from heytings.org ([95.142.160.155]:32786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIH4Y-0006tN-2e for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 18:06:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659305164; bh=7S+qvgJkrTROdaWHqBptX8EHDCARX26tJj8Du1RTc0g=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=RhkiQU/tcdtpqaw0l14RXaZW+q7mUuO1ZBiqD/uJO+JeXzW+JwttjGsHMrpThtENZ N9/hGlwRiakUquer7ejeI6TBP9W15A2R7bcDSGeNHw87cuOi4OjHSMdxhufWh5xOyo FjqYbP4y/EN7/Zvv3/+X6XAtWd80pXHHzdhEryA4syE7Q85CHvH9hqrGXGzqlM9OuP UnJ3KJs+D+KxMize0N+fBWH7yQ8hWJNZA2X6DB0tjkMM0ADmTXVbAsWRwOjuDXpTFX Cyr625bRvwtrHKExCOR4bwQv5AdQ9tYOAkEUEk3TUCTF52eeMQWizjw3mXaRKWTvOe XZ4znzdtBjbzw== In-Reply-To: Content-ID: <8c7321f2f34c83944aee@heytings.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" Xref: news.gmane.io gmane.emacs.bugs:238368 Archived-At: --lnZl2UCHWW Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-ID: <8c7321f2f3e2eba32a53@heytings.org> >>> Emacs is not in the business of preventing people from shooting=20 >>> themselves in the foot. If we need this narrowing to be enforced=20 >>> because Emacs would otherwise crash, then it's OK, but if not, then we= =20 >>> *should* provide a way to undo it. >> >> And how do you define "crash"? > > Core dump. > Aha, interesting! So an infinite loop is not a crash, according to that=20 definition? >> Is Emacs becoming unresponsive because an operation takes say two=20 >> minutes to complete and cannot be interrupted a "crash"? Or is a=20 >> "crash" only a segfault? > > Try `M-: (use-global-map (make-keymap)) RET` > > Should we prevent users from doing that? > It's a misleading question. No "user" would ever do that. Sure, it's a=20 nice example, but only an Elisp hacker would do that, in the middle of a=20 debugging session, and they would do that on purpose (although perhaps=20 without knowing the effect in advance). Which has nothing to do with a=20 regular user who just opens a file. > > Let's focus on making it easy to make it work well, rather than making=20 > it impossible to make it work poorly. > You lost me here. I've read that sentence twenty times, and cannot=20 understand what you mean. >> But you didn't answer my question: is it not possible to design a=20 >> version of syntax-ppss that would approximate, with some heuristics,=20 >> 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=20 > remind the reader that it hasn't really been requested. > It has, now =F0=9F=98=89 Not "requested", however. I respectfully, with a= ll due=20 respect, ask whether doing such a thing would be possible. > > In order to know if POS is within a string (which is one of the main=20 > uses of `syntax-ppss`), you basically need to know if there's an odd or= =20 > even number of quotes before POS, which fundamentally needs to look at=20 > all the chars between POS and BOB. Of course we use a cache to try and= =20 > avoid looking at them over and over again, but the cache can't be of any= =20 > use the first time around. > But if you use heuristics, as I said, you don't need to look at all the=20 chars between BOB and POS. You try your best to guess, on a small (a few= =20 kilobytes) portion of the buffer, where the strings most likely start and= =20 stop. And if you're only right in 95% of the cases, that's more than=20 fine. --lnZl2UCHWW--