unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23278: 25.0.92; font-lock-ensure is too slow
@ 2016-04-12 19:49 Dmitry Gutov
  2016-05-07  8:27 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2016-04-12 19:49 UTC (permalink / raw)
  To: 23278

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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#23278: 25.0.92; font-lock-ensure is too slow
  2016-04-12 19:49 bug#23278: 25.0.92; font-lock-ensure is too slow Dmitry Gutov
@ 2016-05-07  8:27 ` Eli Zaretskii
  2016-05-07 23:10   ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2016-05-07  8:27 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 23278

> From: Dmitry Gutov <dgutov@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23278: 25.0.92; font-lock-ensure is too slow
  2016-05-07  8:27 ` Eli Zaretskii
@ 2016-05-07 23:10   ` Dmitry Gutov
  2016-05-09  0:28     ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2016-05-07 23:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23278-done

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23278: 25.0.92; font-lock-ensure is too slow
  2016-05-07 23:10   ` Dmitry Gutov
@ 2016-05-09  0:28     ` Glenn Morris
  2016-05-09  0:42       ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2016-05-09  0:28 UTC (permalink / raw)
  To: 23278; +Cc: dgutov

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23278: 25.0.92; font-lock-ensure is too slow
  2016-05-09  0:28     ` Glenn Morris
@ 2016-05-09  0:42       ` Dmitry Gutov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2016-05-09  0:42 UTC (permalink / raw)
  To: Glenn Morris, 23278

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-09  0:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-12 19:49 bug#23278: 25.0.92; font-lock-ensure is too slow Dmitry Gutov
2016-05-07  8:27 ` Eli Zaretskii
2016-05-07 23:10   ` Dmitry Gutov
2016-05-09  0:28     ` Glenn Morris
2016-05-09  0:42       ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).