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 08:30:14 +0000 Message-ID: <8c7321f2f3859b5ee60b@heytings.org> References: <831qu7daxb.fsf@gnu.org> <83sfmnb7yg.fsf@gnu.org> <837d3ybh5z.fsf@gnu.org> <136c4fe0fc74196714aa@heytings.org> <83pmhp89ov.fsf@gnu.org> <136c4fe0fc39573addc9@heytings.org> <83k07x8738.fsf@gnu.org> <136c4fe0fcdf00ef9a11@heytings.org> <83h73183r7.fsf@gnu.org> <136c4fe0fc0fceb0d752@heytings.org> <838roc8ka7.fsf@gnu.org> <83tu706obt.fsf@gnu.org> <83h7306ifa.fsf@gnu.org> <83edy37pul.fsf@gnu.org> <83pmhn55sk.fsf@gnu.org> <65cb7c73fdc753518d35@heytings.org> <83fsii68o3.fsf@gnu.org> <65cb7c73fdf6704d19d5@heytings.org> <835yje62vz.fsf@gnu.org> <65cb7c73fd159efe32af@heytings.org> <83zggq4fgb.fsf@gnu.org> <65cb7c73fd6ca16565e1@heytings.org> <83y1wa4e6q.fsf@gnu.org> <65cb7c73fdbf1de53ea7@heytings.org> <83tu6x4xis.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16654"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 31 10:31:26 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 1oI4MA-0004BE-3v for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 10:31:26 +0200 Original-Received: from localhost ([::1]:43834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oI4M9-0003F0-15 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 04:31:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI4Lm-0003Ed-FA for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 04:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oI4Lm-0007go-5P for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 04:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oI4Lm-0006MQ-0S for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 04:31: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 08:31: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.165925621824369 (code B ref 56682); Sun, 31 Jul 2022 08:31:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 08:30:18 +0000 Original-Received: from localhost ([127.0.0.1]:36352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI4L4-0006Ky-E7 for submit@debbugs.gnu.org; Sun, 31 Jul 2022 04:30:18 -0400 Original-Received: from heytings.org ([95.142.160.155]:60240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI4L2-0006Kq-33 for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 04:30:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659256215; bh=6qrLi17OGBvym89+wiBRhJlKCAK6Rt1KFICVwFLjKUo=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=rvHC3LDUeJBUg7hkFAoRyut78JtuUmweNOeMkY+QoLmgHDHxNQfNPLCyn+lBiweSU LLRd9TetpvZaLLarp/nvrmS7IqFEA6u3A1ojN9y1JVV6iBB9XC1I6fta22KJ/Z+/oC bw/0TbUM6ib9IpD6JANuloiPsTFXSu/nNBwrW/0gaI8ACkiZl9o7AEzI/ssmwGolSh jzmDlc6+mvYq1W71MF7oph+1Ev2P21VNBldz2QlgFMJN1wqUNnseAaTw3TlJ/n8S2h iL2vPP0puTx9HJiSKaGWe+xl33SpZHbfGZYDzyS2ni0fz3vR6G5tURH3OV9x+87u1U XcI3FQR9tfnHQ== In-Reply-To: <83tu6x4xis.fsf@gnu.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:238325 Archived-At: > > It sounds...too drastic. > Are you sure? The docstring already says "It is a bad idea to use this hook for expensive processing." And Emacs already removes a function from the hook when it misbhaves. Adding something like "In a too large buffer or in a buffer with long lines, the functions in this hook will only have access to a small portion of the buffer" seems coherent, at least to me. > > Once again, IME it is impossible to fix such problems only in low-level > C infrastructure. There will always be left-overs and fallouts that > should be fixed locally in Lisp where they happen. There's no problem > here, and I don't expect us to be able to fix everything by a small > number of quick fixes, and declare a victory once and for all. > I both agree and disagree with that. It is true that it is, strictly speaking, impossible to fix _all_ such problems _only_ in low-level C intrastructure, and that there will always be left-overs. But it is possible to fix _most_ of these problems only in low-level C infrastructure, and we should do so, just like an operating system kernel in which everything is done to avoid crashing the system/leaving it in an unusable state (which includes killing a mis-behaving process when necessary). And we should do so even more when the amount of code to do so in the low-level C infrastructure remains small. > > Well, WDYT about a similar feature for very large files? IOW, when the > buffer's size is above some threshold, turn on the > long_line_optimizations_p flag (which should perhaps be renamed to > better reflect its purpose) even if no long lines are seen? > I was thinking about such a feature indeed. But it would be separate from the long_line_optimizations_p one, because the optimizations to activate in both cases are different, and their thresholds are different, too.