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: Fri, 12 Aug 2022 21:31:58 +0000 Message-ID: References: <74ddc877f17a06d8f120@heytings.org> <100d08b3-c25b-683f-6def-39052107ab59@yandex.ru> <83h72r16g1.fsf@gnu.org> <640c2e07-98e1-96d6-bb02-19f5f03f637f@yandex.ru> <834jyq29o1.fsf@gnu.org> <92da07bd028e3ede61a6@heytings.org> <47894c57-dd8b-5778-240a-3fa6540e4d37@yandex.ru> <92da07bd02941d5537e9@heytings.org> <5308e3b5-a160-17d7-77ee-b1d00acfa20d@yandex.ru> <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> 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="17932"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 12 23:33: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 1oMcHV-0004Qs-Uo for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Aug 2022 23:33:26 +0200 Original-Received: from localhost ([::1]:44554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMcHT-000372-CB for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Aug 2022 17:33:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMcH8-00036e-V9 for bug-gnu-emacs@gnu.org; Fri, 12 Aug 2022 17:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41087) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMcH8-0002r5-AY for bug-gnu-emacs@gnu.org; Fri, 12 Aug 2022 17:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMcH8-0007Ho-1U for bug-gnu-emacs@gnu.org; Fri, 12 Aug 2022 17:33: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: Fri, 12 Aug 2022 21:33: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.166033992327942 (code B ref 56682); Fri, 12 Aug 2022 21:33:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 12 Aug 2022 21:32:03 +0000 Original-Received: from localhost ([127.0.0.1]:59069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMcGA-0007Gb-Hs for submit@debbugs.gnu.org; Fri, 12 Aug 2022 17:32:02 -0400 Original-Received: from heytings.org ([95.142.160.155]:50314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMcG8-0007G1-6X for 56682@debbugs.gnu.org; Fri, 12 Aug 2022 17:32:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1660339918; bh=zz2ffJDYz+S5uIH8h+dHKvEzFG+XZZtd7eGrmWxzMFo=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=Fqd9WQNXLYrm/nJYKQhICs/whTqIuqEB3GXLT1ERnSJQvKgDbHoxsBcfbDBCOKl1H fPrmCxz5sO79ECtFzoUxrSarU1aFx5R/r9o63ocrJH9d/86M5Y34cN7G2V7Tir+M7Y JvUIK1Bqanv4tAFbk3h+aoEpJRtkRWsaHKvtITsh4puafDDlaecBMjBuJvT21LZD0L I0Y3safCwBHTFJ1srLkLZ4qeP24eQBOM/+elUGnIFpNF452zLYHCrG8B74MmSafC2K 8pCV9++Zd42muaTAsW1SByKsE+SwY/V9TYyK1fVLW2dXvAkTPA+rWOEbwOXkF4EWKO LaNX4XpMspeJA== In-Reply-To: <1144021660321893@iva5-64778ce1ba26.qloud-c.yandex.net> 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:239468 Archived-At: > > I have eliminated two performance problems frim js-json-mode that are > uncharacteristic for font-lock in general. > This is where we disagree: they _are_ characteristic of font locking in general, in all modes (in core and in the wild) that use widen in their font locking routines and/or do complex calculations far away from the region that must be fontified. >> although it is still too slow to my taste for larger files, e.g. I have >> to wait five seconds after M-> in a ten times larger JSON file). And >> the original problem is still present if you edit, for example, a 20 MB >> minified JavaScript file... > > Hence the new user option. > The goal of this effort is not, and never was, to make editing the dictionary.json file reasonably fast with an optimized build on a Core i9 computer. That file is, again, just an example. The goal of this effort is to make editing any large file as smooth as possible, out of the box, regardless of the major (and minor) modes that are are enabled, even with a less efficient CPU, e.g. a Raspberry Pi computer, or a lower end laptop with its CPU running at a lower frequency. Which is why fixing js-mode, and adding a json-mode, as you did, is a "too local" fix. Of course, that doesn't mean what you did is useless; it only means that it cannot be considered as a general solution to the problem at hand. I can only repeat that the only ways to improve font locking in a non-local way (or at least, the only ways that were identified in the discussions so far) are either to improve the speed of syntax-ppss by an order of magnitude, in which case it would perhaps become feasible to allow syntax-ppss to have access to the whole buffer, or to equip syntax-ppss with heuristics to make it work "as well as possible" even when it only has access to a portion of the buffer.