bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00e


From: Clément Pit--Claudel
Subject: bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00ef86fac835b5fac (Apr 2014).
Date: Mon, 13 Mar 2017 12:36:25 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 2017-03-13 11:46, Eli Zaretskii wrote:
> I installed Fira Sans and Noto Sans, and changed your program to insert
> more of these characters and actually display all the characters it
> inserts (see below).

Thanks, that's a much better repro than mine :) Here are my timings:

# Stock 24.5
12:01:26 /build/emacs
$ time 24.5/src/emacs -Q --eval "(progn (set-fontset-font \"fontset-startup\" 
'unicode \"Noto Sans\" nil) (set-fontset-font \"fontset-startup\" 'unicode 
\"Symbola\" nil 'append) (dotimes (_ 5000) (insert (make-string 20 8658) 
\"\n\")) (goto-char (point-min)) (sit-for 0) (condition-case nil (while t 
(scroll-up) (sit-for 0)) (error nil)) (run-with-idle-timer 0 nil #'kill-emacs))"
real    1m1.862s
user    0m18.644s
sys     0m15.972s

# Stock 25.1
$ time 25.1/src/emacs -Q --eval "(progn (set-fontset-font \"fontset-startup\" 
'unicode \"Noto Sans\" nil) (set-fontset-font \"fontset-startup\" 'unicode 
\"Symbola\" nil 'append) (dotimes (_ 5000) (insert (make-string 20 8658) 
\"\n\")) (goto-char (point-min)) (sit-for 0) (condition-case nil (while t 
(scroll-up) (sit-for 0)) (error nil)) (run-with-idle-timer 0 nil #'kill-emacs))"
real    1m4.705s
user    0m18.296s
sys     0m18.444s

# Master with your patch
$ time master/src/emacs -Q --eval "(progn (set-fontset-font \"fontset-startup\" 
'unicode \"Noto Sans\" nil) (set-fontset-font \"fontset-startup\" 'unicode 
\"Symbola\" nil 'append) (dotimes (_ 5000) (insert (make-string 20 8658) 
\"\n\")) (goto-char (point-min)) (sit-for 0) (condition-case nil (while t 
(scroll-up) (sit-for 0)) (error nil)) (run-with-idle-timer 0 nil #'kill-emacs))"
real    0m1.207s
user    0m0.928s
sys     0m0.028s

> If I don't specify the "normal" font in the fontset, only Symbola, or
> if I don't specify fonts at all (Symbola is used by default for the
> character in question), then I get timings like the one below:

I get similar timings.

>   . Why is your 1.5 sec timing deemed "unusably slow" vs 0.35 sec
>     which is the normal speed?  

Because my repro wasn't very good, apparently :) As you see above, your tests 
takes 1 minute without your patch, and 1 second with it.

>     If I use the same session (with
>     hundreds of U+21D2 symbols) interactively, the display is quite
>     responsive, and 6 sec for scrolling 5000 lines doesn't sound
>     "unusable" to me.

Some redisplays cycles takes as much as a few seconds. That's enough to make it 
impossible to use Emacs.  In this concrete example, pressing the up arow 
introduces a half-second lag.  Pressing M-x doesn't show anything for close to 
.5 seconds.  Keeping the down arrow pressed for 1 second stops redisplay until 
I release the key, and then Emacs stays frozen for tens of seconds before 
redisplaying anything.

>     Are you sure the above program exhibits your
>     real-life problem?  Is it possible we are chasing the wrong geese
>     here?

I this it does exhibit my problem, as we saw above.

>   . Why are you setting up your fontset with 2 fonts and claim that
>     both support the entire Unicode range (as opposed to adding to the
>     fontset just one font for specific ranges of codepoints not
>     covered well by the default font)?  

Because you asked me for a minimal repro for my bug :)  In real life, I have 
more than 6 fonts, all covering different subsets (I linked to my own config in 
a previous post in this thread).  I don't know exactly what Ubuntu Mono covers, 
and in fact that changes from time to time, so I just want it to display 
everything it can (hence the first invocation with 'unicode). Then I want to 
use Segoe UI for emoji, so I use a range for that.  And then I then want 
Symbola to be used for any symbol that it covers that are not covered by the 
previous two fonts — hence the second call with 'unicode.  I then have a few 
fonts for various CJK ranges, but even there I don't know what exact range each 
font covers.

But I guess it boils down to: "⇒" is not the only symbol I use, and I don't 
want to encode all ranges supported by Symbola explicitly in my emacs config 
(nor, of course, all the CJK ranges supported by the barious fonts I use for 
east-asian scripts).  As I noted previously, remember that the original bug 
report didn't even use symbols (I ran into this when trying to edit text 
written in Chinese in Emacs.

>   . Finally, what are the values of the following variables in your
>     Emacs used for timings?  (I don't see them anywhere in this bug's
>     discussions, apologies if I missed something.)
> 
>       system-configuration-options
>       system-configuration-features

In both, system-configuration-options is ""
system-configuration-features is "XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND 
GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT 
LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11" in 25.1 (slow), and "XPM JPEG 
TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL 
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS 
GTK3 X11 LIBSYSTEMD" in master with your patch (fast).

> Bottom line: it is strange that you alone see these problems, and no
> one else AFAIR complained about unusably slow prettify-symbols-mode
> display.

I'm not alone.  At least one other person posted to this bug list 
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21028#74) and confirmed that the 
patch fixed their problem. The problem gets regularly mentioned elsewhere (when 
I opened this bug I linked to https://github.com/purcell/emacs.d/issues/273 
"when I first try to input some chinese characters, it's very slow to moving 
[...] especially use C-n, C-p, emacs will hang for about 1~2 seconds."; a more 
recent example is at 
https://sympa.inria.fr/sympa/arc/coq-club/2017-03/msg00050.html "Appending to 
the 'unicode list makes emacs unbearably slow.").  Additionally, as the 
maintainer of company-coq, I've had multiple people tell me that it was just 
too slow to use, only to realize that turning off prettify-symbols-mode was 
enough to make everything snappy again for them.

Clément.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]