GNU bug report logs - #56682
Fix the long lines font locking related slowdowns

Previous Next

Package: emacs;

Reported by: Gregory Heytings <gregory <at> heytings.org>

Date: Thu, 21 Jul 2022 18:01:01 UTC

Severity: normal

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gregory Heytings <gregory <at> heytings.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 56682 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, monnier <at> iro.umontreal.ca
Subject: bug#56682: Fix the long lines font locking related slowdowns
Date: Fri, 12 Aug 2022 21:31:58 +0000
> 
> 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.




This bug report was last modified 2 years and 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.