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: Sat, 18 Jul 2015 13:08:09 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 07/18/2015 04:26 AM, Eli Zaretskii wrote:
>> Date: Sat, 18 Jul 2015 04:16:16 -0700
>> From: Clément Pit--Claudel
>>  <address@hidden>
>> CC: Eli Zaretskii <address@hidden>, address@hidden
>>
>> 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 (address@hidden) at xterm.c:7471
#7  0x00000000005b06f9 in xfont_list_pattern (address@hidden, 
    address@hidden "Arial", address@hidden, address@hidden)
    at xfont.c:367
#8  0x00000000005b10ae in xfont_list (f=<optimized out>, spec=12261565) at 
xfont.c:560
#9  0x000000000056a879 in font_list_entities (address@hidden, address@hidden) 
at font.c:2756
#10 0x000000000056b242 in font_find_for_lface (address@hidden, address@hidden, 
    spec=<optimized out>, address@hidden) at font.c:3232
#11 0x00000000005b9481 in fontset_find_font (fontset=19770717, address@hidden, 
address@hidden, 
    address@hidden, address@hidden) at fontset.c:681
#12 0x00000000005b9940 in fontset_font (address@hidden, address@hidden, 
address@hidden, 
    id=-1) at fontset.c:754
#13 0x00000000005ba3ea in face_for_char (f=0x112a4b8, address@hidden, c=22269, 
pos=<optimized out>, 
    object=<optimized out>) at fontset.c:956
#14 0x000000000043ff68 in get_next_display_element (address@hidden) at 
xdisp.c:7064
#15 0x00000000004456e0 in display_line (address@hidden) at xdisp.c:19867
#16 0x000000000044962a in try_window (address@hidden, pos=..., address@hidden) 
at xdisp.c:16685
#17 0x000000000045d312 in redisplay_window (window=18003149, address@hidden)
    at xdisp.c:16367
#18 0x0000000000461193 in redisplay_window_0 (address@hidden) at xdisp.c:14157
#19 0x00000000005545a6 in internal_condition_case_1 (address@hidden 
<redisplay_window_0>, arg=18003149, 
    handlers=<optimized out>, address@hidden <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, address@hidden, 
prev_event=12108082, 
    address@hidden, address@hidden) at keyboard.c:2569
#24 0x00000000004f1353 in read_key_sequence (address@hidden, prompt=12108082, 
    address@hidden, address@hidden, 
    address@hidden, address@hidden, bufsize=30)
    at keyboard.c:9081
#25 0x00000000004f2f70 in command_loop_1 () at keyboard.c:1449
#26 0x000000000055447e in internal_condition_case (address@hidden 
<command_loop_1>, 
    handlers=<optimized out>, address@hidden <cmd_error>) at eval.c:1354
#27 0x00000000004e546e in command_loop_2 (address@hidden) at keyboard.c:1174
#28 0x000000000055438b in internal_catch (tag=12155586, address@hidden 
<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 (address@hidden, address@hidden) 
at font.c:2756
#8  0x000000000056b242 in font_find_for_lface (address@hidden, address@hidden, 
    spec=<optimized out>, address@hidden) at font.c:3232
#9  0x00000000005b9481 in fontset_find_font (fontset=19770717, address@hidden, 
address@hidden, 
    address@hidden, address@hidden) at fontset.c:681
#10 0x00000000005b9940 in fontset_font (address@hidden, address@hidden, 
address@hidden, 
    id=-1) at fontset.c:754
#11 0x00000000005ba3ea in face_for_char (f=0x112a4b8, address@hidden, c=22269, 
pos=<optimized out>, 
    object=<optimized out>) at fontset.c:956
#12 0x000000000043ff68 in get_next_display_element (address@hidden) at 
xdisp.c:7064
#13 0x000000000043d8d1 in move_it_in_display_line_to (address@hidden, 
address@hidden, 
    address@hidden, address@hidden) at xdisp.c:8504
#14 0x00000000004450ec in move_it_to (address@hidden, address@hidden, 
    address@hidden, address@hidden, address@hidden, address@hidden) at 
xdisp.c:9145
#15 0x000000000044999d in move_it_vertically_backward (address@hidden, 
address@hidden) at xdisp.c:9318
#16 0x000000000045d26b in redisplay_window (window=18003149, address@hidden)
    at xdisp.c:16330
#17 0x0000000000461193 in redisplay_window_0 (address@hidden) at xdisp.c:14157
#18 0x00000000005545a6 in internal_condition_case_1 (address@hidden 
<redisplay_window_0>, arg=18003149, 
    handlers=<optimized out>, address@hidden <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, address@hidden, 
prev_event=12108082, 
    address@hidden, address@hidden) at keyboard.c:2569
#23 0x00000000004f1353 in read_key_sequence (address@hidden, prompt=12108082, 
    address@hidden, address@hidden, 
    address@hidden, address@hidden, bufsize=30)
    at keyboard.c:9081
#24 0x00000000004f2f70 in command_loop_1 () at keyboard.c:1449
#25 0x000000000055447e in internal_condition_case (address@hidden 
<command_loop_1>, 
    handlers=<optimized out>, address@hidden <cmd_error>) at eval.c:1354
#26 0x00000000004e546e in command_loop_2 (address@hidden) at keyboard.c:1174
#27 0x000000000055438b in internal_catch (tag=12155586, address@hidden 
<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: signature.asc
Description: OpenPGP digital signature


reply via email to

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