GNU bug report logs - #23278
25.0.92; font-lock-ensure is too slow

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Tue, 12 Apr 2016 19:50:01 UTC

Severity: normal

Tags: patch

Found in version 25.0.92

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23278 in the body.
You can then email your comments to 23278 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23278; Package emacs. (Tue, 12 Apr 2016 19:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Gutov <dgutov <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Apr 2016 19:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.92; font-lock-ensure is too slow
Date: Tue, 12 Apr 2016 22:49:09 +0300
Example:

Open xdisp.c, navigate to the first line. Evaluate:

(load "jit-lock")
(benchmark 1000 '(font-lock-ensure (line-beginning-position)
                                   (line-end-position)))

=> 0.66s

Which puts a dampener on the idea of syntax highlighting xref results in
the open files.

With the patch below, the benchmark executes 100 times faster.
OK to apply?

diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 810c220..a582c48 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -387,10 +387,11 @@ jit-lock-fontify-now
 	 ;; Fontify chunks beginning at START.  The end of a
 	 ;; chunk is either `end', or the start of a region
 	 ;; before `end' that has already been fontified.
-	 (while (and start (< start end))
-	   ;; Determine the end of this chunk.
-	   (setq next (or (text-property-any start end 'fontified t)
-			  end))
+	 (while (and start
+                     (< start
+                        ;; Determine the end of this chunk.
+                        (setq next (or (text-property-any start end 'fontified t)
+                                       end))))
 
 	   ;; Fontify the chunk, and mark it as fontified.
 	   ;; We mark it first, to make sure that we don't indefinitely


In GNU Emacs 25.0.92.12 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.7)
 of 2016-04-10 built on axl
Repository revision: 20686f7a6430ef37f17b3866f14e7dc3095c1524
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	Ubuntu 15.10




Added tag(s) patch. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 25 Apr 2016 23:27:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23278; Package emacs. (Sat, 07 May 2016 08:28:01 GMT) Full text and rfc822 format available.

Message #10 received at 23278 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 23278 <at> debbugs.gnu.org
Subject: Re: bug#23278: 25.0.92; font-lock-ensure is too slow
Date: Sat, 07 May 2016 11:27:09 +0300
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Tue, 12 Apr 2016 22:49:09 +0300
> 
> Example:
> 
> Open xdisp.c, navigate to the first line. Evaluate:
> 
> (load "jit-lock")
> (benchmark 1000 '(font-lock-ensure (line-beginning-position)
>                                    (line-end-position)))
> 
> => 0.66s
> 
> Which puts a dampener on the idea of syntax highlighting xref results in
> the open files.
> 
> With the patch below, the benchmark executes 100 times faster.
> OK to apply?

If you run with this since the time of your message and saw no
problems, please push to emacs-25.  Otherwise, to master.

Thanks.




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Sat, 07 May 2016 23:12:01 GMT) Full text and rfc822 format available.

Notification sent to Dmitry Gutov <dgutov <at> yandex.ru>:
bug acknowledged by developer. (Sat, 07 May 2016 23:12:01 GMT) Full text and rfc822 format available.

Message #15 received at 23278-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23278-done <at> debbugs.gnu.org
Subject: Re: bug#23278: 25.0.92; font-lock-ensure is too slow
Date: Sun, 8 May 2016 02:10:26 +0300
On 05/07/2016 11:27 AM, Eli Zaretskii wrote:

> If you run with this since the time of your message and saw no
> problems, please push to emacs-25.  Otherwise, to master.

I didn't, and upon further consideration that patch had a bug (failed 
'jit-lock-fontify-mends-the-gaps' in the newly added jit-lock-tests.el).

I've pushed an updated patch to master, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23278; Package emacs. (Mon, 09 May 2016 00:30:02 GMT) Full text and rfc822 format available.

Message #18 received at 23278 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 23278 <at> debbugs.gnu.org
Cc: dgutov <at> yandex.ru
Subject: Re: bug#23278: 25.0.92; font-lock-ensure is too slow
Date: Sun, 08 May 2016 20:28:56 -0400
Dmitry Gutov wrote:

> On 05/07/2016 11:27 AM, Eli Zaretskii wrote:
>
>> If you run with this since the time of your message and saw no
>> problems, please push to emacs-25.  Otherwise, to master.
>
> I didn't, and upon further consideration that patch had a bug (failed
> jit-lock-fontify-mends-the-gaps' in the newly added
> jit-lock-tests.el).

I don't know if it related, but jit-lock tests currently fail, eg
http://hydra.nixos.org/build/35362603




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23278; Package emacs. (Mon, 09 May 2016 00:44:01 GMT) Full text and rfc822 format available.

Message #21 received at 23278 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Glenn Morris <rgm <at> gnu.org>, 23278 <at> debbugs.gnu.org
Subject: Re: bug#23278: 25.0.92; font-lock-ensure is too slow
Date: Mon, 9 May 2016 03:42:54 +0300
On 05/09/2016 03:28 AM, Glenn Morris wrote:

> I don't know if it related, but jit-lock tests currently fail, eg
> http://hydra.nixos.org/build/35362603

Thanks for letting me know.

It's not a regression, they were failing in noninteractive mode. Should 
be fixed now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 06 Jun 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 18 days ago.

Previous Next


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