all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pitclaudel@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21028@debbugs.gnu.org, dmantipov@yandex.ru
Subject: bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00ef86fac835b5fac (Apr 2014).
Date: Sat, 18 Jul 2015 13:08:09 -0700	[thread overview]
Message-ID: <55AAB229.4070108@live.com> (raw)
In-Reply-To: <83egk5671e.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 9233 bytes --]

On 07/18/2015 04:26 AM, Eli Zaretskii wrote:
>> Date: Sat, 18 Jul 2015 04:16:16 -0700
>> From: Clément Pit--Claudel
>>  <clement.pitclaudel@live.com>
>> CC: Eli Zaretskii <eliz@gnu.org>, 21028@debbugs.gnu.org
>>
>> I've spent a bit more time looking into this. The problem is due to the following three lines being conditioned on `!NILP(val)`: (that's around line 2780 of src/font.c)
>>
>>     Lisp_Object copy = copy_font_spec (scratch_font_spec);
>>     ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
>>     XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
>>
>> Before af1a69f, these lines were always run. In af1a69f, they only run if `val` is non nil, causing the regression: on master, moving them back out of the if statement fixes the problem.
> 
> Thanks.  Do you understand how doing something only sometimes could be
> slower than doing it always?

My guess would be that these lines themselves aren't slow, but omitting them makes things slow. In addition to the two perf traces that I sent, here are the two most common stack traces that I get when I interrupt the text insertion loop using [(gdb) run -Q --eval "(progn (dotimes (_ 10) (set-fontset-font t 'unicode (font-spec :name \"Arial\") nil 'append)) (redisplay t) (dotimes (_ 500) (insert \"日本国\n\")))"]

* 3/4 of the time I get this one:
(gdb) backtrace
#0  0x00007ffff164912d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007fffee12db72 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007fffee12f3ff in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007fffee12f512 in xcb_wait_for_reply () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#4  0x00007ffff4c9948f in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007ffff4c950cd in XSync () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00000000004bdfb5 in x_catch_errors (dpy=dpy@entry=0xbe58d0) at xterm.c:7471
#7  0x00000000005b06f9 in xfont_list_pattern (display=display@entry=0xbe58d0, 
    pattern=pattern@entry=0x7fffffff6f20 "Arial", registry=registry@entry=12339538, script=script@entry=12108082)
    at xfont.c:367
#8  0x00000000005b10ae in xfont_list (f=<optimized out>, spec=12261565) at xfont.c:560
#9  0x000000000056a879 in font_list_entities (f=f@entry=0x112a4b8, spec=spec@entry=18635693) at font.c:2756
#10 0x000000000056b242 in font_find_for_lface (f=f@entry=0x112a4b8, attrs=attrs@entry=0x1807320, 
    spec=<optimized out>, c=c@entry=22269) at font.c:3232
#11 0x00000000005b9481 in fontset_find_font (fontset=19770717, c=c@entry=22269, face=face@entry=0x1807320, 
    id=id@entry=-1, fallback=fallback@entry=false) at fontset.c:681
#12 0x00000000005b9940 in fontset_font (fontset=fontset@entry=18249853, c=c@entry=22269, face=face@entry=0x1807320, 
    id=-1) at fontset.c:754
#13 0x00000000005ba3ea in face_for_char (f=0x112a4b8, face=face@entry=0x1807320, c=22269, pos=<optimized out>, 
    object=<optimized out>) at fontset.c:956
#14 0x000000000043ff68 in get_next_display_element (it=it@entry=0x7fffffff8ff0) at xdisp.c:7064
#15 0x00000000004456e0 in display_line (it=it@entry=0x7fffffff8ff0) at xdisp.c:19867
#16 0x000000000044962a in try_window (window=window@entry=18003149, pos=..., flags=flags@entry=0) at xdisp.c:16685
#17 0x000000000045d312 in redisplay_window (window=18003149, just_this_one_p=just_this_one_p@entry=false)
    at xdisp.c:16367
#18 0x0000000000461193 in redisplay_window_0 (window=window@entry=18003149) at xdisp.c:14157
#19 0x00000000005545a6 in internal_condition_case_1 (bfun=bfun@entry=0x461160 <redisplay_window_0>, arg=18003149, 
    handlers=<optimized out>, hfun=hfun@entry=0x42b360 <redisplay_window_error>) at eval.c:1378
#20 0x000000000042fbfe in redisplay_windows (window=18003149) at xdisp.c:14137
#21 0x000000000044dfb1 in redisplay_internal () at xdisp.c:13736
#22 0x000000000044fdd5 in redisplay () at xdisp.c:13022
#23 0x00000000004ef9e1 in read_char (commandflag=1, map=map@entry=19387718, prev_event=12108082, 
    used_mouse_menu=used_mouse_menu@entry=0x7fffffffd71b, end_time=end_time@entry=0x0) at keyboard.c:2569
#24 0x00000000004f1353 in read_key_sequence (keybuf=keybuf@entry=0x7fffffffd7f0, prompt=12108082, 
    dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, 
    fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, bufsize=30)
    at keyboard.c:9081
#25 0x00000000004f2f70 in command_loop_1 () at keyboard.c:1449
#26 0x000000000055447e in internal_condition_case (bfun=bfun@entry=0x4f2d80 <command_loop_1>, 
    handlers=<optimized out>, hfun=hfun@entry=0x4e9d40 <cmd_error>) at eval.c:1354
#27 0x00000000004e546e in command_loop_2 (ignore=ignore@entry=12108082) at keyboard.c:1174
#28 0x000000000055438b in internal_catch (tag=12155586, func=func@entry=0x4e5450 <command_loop_2>, arg=12108082)
    at eval.c:1118
#29 0x00000000004e9967 in command_loop () at keyboard.c:1153
#30 recursive_edit_1 () at keyboard.c:777
#31 0x00000000004e9c52 in Frecursive_edit () at keyboard.c:845
#32 0x0000000000417f75 in main (argc=<optimized out>, argv=0x7fffffffdb48) at emacs.c:1654

* 1/4 of the time I get that one:
(gdb) backtrace
#0  0x00007ffff2453900 in ?? () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#1  0x00007ffff24543b6 in ?? () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#2  0x00007ffff246185d in ?? () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#3  0x00007ffff24619b0 in FcFontSetList () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#4  0x00007ffff24621ff in FcFontList () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
#5  0x00000000005b3792 in ftfont_list (f=<optimized out>, spec=12261565) at ftfont.c:955
#6  0x00000000005b61fa in xftfont_list (f=<optimized out>, spec=<optimized out>) at xftfont.c:141
#7  0x000000000056a879 in font_list_entities (f=f@entry=0x112a4b8, spec=spec@entry=18192877) at font.c:2756
#8  0x000000000056b242 in font_find_for_lface (f=f@entry=0x112a4b8, attrs=attrs@entry=0x1807320, 
    spec=<optimized out>, c=c@entry=22269) at font.c:3232
#9  0x00000000005b9481 in fontset_find_font (fontset=19770717, c=c@entry=22269, face=face@entry=0x1807320, 
    id=id@entry=-1, fallback=fallback@entry=false) at fontset.c:681
#10 0x00000000005b9940 in fontset_font (fontset=fontset@entry=18249853, c=c@entry=22269, face=face@entry=0x1807320, 
    id=-1) at fontset.c:754
#11 0x00000000005ba3ea in face_for_char (f=0x112a4b8, face=face@entry=0x1807320, c=22269, pos=<optimized out>, 
    object=<optimized out>) at fontset.c:956
#12 0x000000000043ff68 in get_next_display_element (it=it@entry=0x7fffffff82f0) at xdisp.c:7064
#13 0x000000000043d8d1 in move_it_in_display_line_to (it=it@entry=0x7fffffff82f0, to_charpos=to_charpos@entry=2001, 
    to_x=to_x@entry=-1, op=op@entry=MOVE_TO_POS) at xdisp.c:8504
#14 0x00000000004450ec in move_it_to (it=it@entry=0x7fffffff82f0, to_charpos=to_charpos@entry=2001, 
    to_x=to_x@entry=-1, to_y=to_y@entry=-1, to_vpos=to_vpos@entry=-1, op=op@entry=8) at xdisp.c:9145
#15 0x000000000044999d in move_it_vertically_backward (it=it@entry=0x7fffffff9e60, dy=dy@entry=280) at xdisp.c:9318
#16 0x000000000045d26b in redisplay_window (window=18003149, just_this_one_p=just_this_one_p@entry=false)
    at xdisp.c:16330
#17 0x0000000000461193 in redisplay_window_0 (window=window@entry=18003149) at xdisp.c:14157
#18 0x00000000005545a6 in internal_condition_case_1 (bfun=bfun@entry=0x461160 <redisplay_window_0>, arg=18003149, 
    handlers=<optimized out>, hfun=hfun@entry=0x42b360 <redisplay_window_error>) at eval.c:1378
#19 0x000000000042fbfe in redisplay_windows (window=18003149) at xdisp.c:14137
#20 0x000000000044dfb1 in redisplay_internal () at xdisp.c:13736
#21 0x000000000044fdd5 in redisplay () at xdisp.c:13022
#22 0x00000000004ef9e1 in read_char (commandflag=1, map=map@entry=19387718, prev_event=12108082, 
    used_mouse_menu=used_mouse_menu@entry=0x7fffffffd71b, end_time=end_time@entry=0x0) at keyboard.c:2569
#23 0x00000000004f1353 in read_key_sequence (keybuf=keybuf@entry=0x7fffffffd7f0, prompt=12108082, 
    dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, 
    fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, bufsize=30)
    at keyboard.c:9081
#24 0x00000000004f2f70 in command_loop_1 () at keyboard.c:1449
#25 0x000000000055447e in internal_condition_case (bfun=bfun@entry=0x4f2d80 <command_loop_1>, 
    handlers=<optimized out>, hfun=hfun@entry=0x4e9d40 <cmd_error>) at eval.c:1354
#26 0x00000000004e546e in command_loop_2 (ignore=ignore@entry=12108082) at keyboard.c:1174
#27 0x000000000055438b in internal_catch (tag=12155586, func=func@entry=0x4e5450 <command_loop_2>, arg=12108082)
    at eval.c:1118
#28 0x00000000004e9967 in command_loop () at keyboard.c:1153
#29 recursive_edit_1 () at keyboard.c:777
#30 0x00000000004e9c52 in Frecursive_edit () at keyboard.c:845
#31 0x0000000000417f75 in main (argc=<optimized out>, argv=0x7fffffffdb48) at emacs.c:1654

Hopefully someone can make sense of this.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2015-07-18 20:08 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 10:34 bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00ef86fac835b5fac (Apr 2014) Clément Pit--Claudel
2015-07-10 12:30 ` Eli Zaretskii
2015-07-10 16:02   ` Clément Pit--Claudel
2015-07-10 12:41 ` Eli Zaretskii
2015-07-10 16:55   ` Clément Pit--Claudel
2015-07-15 12:32     ` Dmitry Antipov
2015-07-18 10:24       ` Clément Pit--Claudel
2015-07-18 11:16         ` Clément Pit--Claudel
2015-07-18 11:26           ` Eli Zaretskii
2015-07-18 20:08             ` Clément Pit--Claudel [this message]
2016-03-03  6:12       ` Clément Pit--Claudel
2016-03-03  6:42         ` Clément Pit--Claudel
2016-03-03  7:08           ` Clément Pit--Claudel
2016-03-03  7:33             ` Clément Pit--Claudel
2016-03-03 17:10               ` Glenn Morris
2016-03-03 17:28                 ` Clément Pit--Claudel
2016-03-03 20:27               ` Eli Zaretskii
2016-07-20 21:26                 ` Clément Pit--Claudel
2016-07-21 14:21                   ` Eli Zaretskii
2016-07-21 14:33                     ` Clément Pit--Claudel
2016-07-23 20:50                     ` Clément Pit--Claudel
2016-10-04 22:17                       ` Clément Pit--Claudel
2016-10-26 17:15                         ` Clément Pit--Claudel
2016-10-27 14:38                           ` Eli Zaretskii
2016-10-27 15:29                             ` Clément Pit--Claudel
2016-10-27 15:55                               ` Eli Zaretskii
2016-10-28 14:23                                 ` Clément Pit--Claudel
2016-10-28 14:33                                   ` Eli Zaretskii
2016-11-18  8:55                                     ` Eli Zaretskii
2016-12-18 17:33                                     ` Clément Pit--Claudel
2016-12-18 17:37                                       ` Eli Zaretskii
2016-12-18 18:04                                         ` Clément Pit--Claudel
2016-12-18 19:52                                           ` Eli Zaretskii
2016-12-18 20:44                                             ` Clément Pit--Claudel
2016-12-19 15:50                                               ` Eli Zaretskii
2016-12-19 16:25                                                 ` Clément Pit--Claudel
2016-12-19 16:39                                                   ` Eli Zaretskii
2016-12-19 16:55                                                     ` Clément Pit--Claudel
2016-12-19 16:58                                                       ` Eli Zaretskii
2016-12-19 17:13                                                         ` Clément Pit--Claudel
2016-12-22 16:25                                                           ` Eli Zaretskii
2016-12-22 16:49                                                             ` Clément Pit--Claudel
2016-12-22 18:04                                                               ` Eli Zaretskii
2016-12-22 19:08                                                                 ` Clément Pit--Claudel
2017-02-10  4:45                                                                   ` Clément Pit--Claudel
2017-03-12 11:38                                                                     ` Clément Pit--Claudel
2017-03-12 15:49                                                                       ` Eli Zaretskii
2017-03-12 17:24                                                                         ` Clément Pit--Claudel
2017-03-12 17:48                                                                           ` Eli Zaretskii
2017-03-12 19:19                                                                             ` Clément Pit--Claudel
2017-03-13 15:46                                                                               ` Eli Zaretskii
2017-03-13 16:36                                                                                 ` Clément Pit--Claudel
2017-03-13 17:22                                                                                   ` Eli Zaretskii
2017-03-13 19:04                                                                                     ` Clément Pit--Claudel
2017-03-13 20:53                                                                                       ` Eli Zaretskii
2017-03-14 19:45                                                                                         ` Clément Pit--Claudel
2017-03-15 15:37                                                                                           ` Eli Zaretskii
2017-03-14 15:45                                                                                       ` Eli Zaretskii
2017-03-14 19:35                                                                                         ` Clément Pit--Claudel
2017-03-15 15:36                                                                                           ` Eli Zaretskii
2017-03-15 20:46                                                                                             ` Clément Pit--Claudel
2017-03-16 15:27                                                                                               ` Eli Zaretskii
2017-03-16 21:23                                                                                                 ` Clément Pit--Claudel
2017-03-17  8:15                                                                                                   ` Eli Zaretskii
2017-04-16  7:48                                                                                                 ` Eli Zaretskii
2017-04-16 15:28                                                                                                   ` Clément Pit--Claudel
2016-12-19 17:00                                                     ` Clément Pit--Claudel
2015-07-10 15:42 ` Glenn Morris
2016-03-03  6:37   ` Clément Pit--Claudel
2016-10-04 18:56 ` Jason Gross
2017-03-13 15:54 ` bug#21028: Slow font rendering in emacs Ralf Jung
2017-03-13 17:05   ` Eli Zaretskii
2017-03-13 18:12     ` Ralf Jung
2017-03-13 20:39       ` Eli Zaretskii
2017-03-14 15:57         ` Ralf Jung
2017-03-14 17:11           ` Eli Zaretskii
2017-03-14 18:50             ` Ralf Jung
2017-03-14 19:16               ` Eli Zaretskii
2017-03-14 19:17             ` Ralf Jung
2017-03-14 20:49             ` John Mastro
2017-03-15 15:40               ` Eli Zaretskii
2017-03-14 15:47   ` Eli Zaretskii
2017-03-14 18:41     ` Ralf Jung
2017-03-14 19:16       ` Eli Zaretskii
2017-03-14 19:39         ` Ralf Jung
2017-03-14 19:45           ` Ralf Jung
2017-03-15 15:36           ` Eli Zaretskii
2017-04-22  8:54             ` Ralf Jung
2017-04-22 13:40               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55AAB229.4070108@live.com \
    --to=clement.pitclaudel@live.com \
    --cc=21028@debbugs.gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.