GNU bug report logs - #25706
26.0.50; Slow C file fontification

Previous Next

Packages: emacs, cc-mode;

Reported by: Sujith <m.sujith <at> gmail.com>

Date: Mon, 13 Feb 2017 18:41:01 UTC

Severity: normal

Tags: moreinfo

Found in version 26.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattiase <at> acm.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 25706 <at> debbugs.gnu.org
Subject: bug#25706: 26.0.50; Slow C file fontification
Date: Tue, 1 Dec 2020 13:03:21 +0100
1 dec. 2020 kl. 10.21 skrev Alan Mackenzie <acm <at> muc.de>:

> (i) Take the first 10% of the original 4MB file, and save it in a
>  different file.
> (ii) Fontify that file from top to bottom: according to EPL, 292s
> (iii) Insert 9 new lines "{}" every 10% of that new file.
> (iv) Fontify the amended file top to bottom: new time 98s.
> 
> That's a factor of 3 different.

Thank you, quite remarkable and a very useful piece of information!
Please let me curb some unwarranted optimism that I'm guilty of engendering:

We have been measuring slightly different things. Being lazy, I timed the fontification in one go:

 (font-lock-ensure (point-min) (point-max))

which took about 65 s originally and went down to about 24 s by fixing the regexps as previously mentioned. Much better but still not wonderful.

You have measured interactive scrolling which is more realistic, but fontifying the buffer piecemeal it exercises slightly different code paths. Fixing those regexps helps but not as much, and clearly more work is needed.

(By the way, could you direct me to your benchmark code? I don't think I have it.)

Still, improving regexps is clearly beneficial. Reducing allocation can be effective as well; a fair bit of the profile is in the GC.





This bug report was last modified 4 years and 213 days ago.

Previous Next


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