Subject: bug#15555: Re: bug#15555: 24.3; Bidirectional display very slow with long lines

From: Dmitry Antipov <[email-masked]>
Date: Tue, 18 Feb 2014 21:34:46 +0400

On 02/18/2014 08:24 PM, Eli Zaretskii wrote:

> If you show me where these calls are made, I might be able to say
> something intelligent about that.  And maybe we could even discuss the
> issue and find some clever solution, if it exists.

(gdb) b bidi.c:669 ;;; at xmalloc
Breakpoint 1 at 0x500890: file ../../trunk/src/bidi.c, line 669.
(gdb) b bidi.c:756 ;;; at xfree
Breakpoint 2 at 0x500b55: file ../../trunk/src/bidi.c, line 756.
(gdb) r -Q /tmp/4000.txt

In 4000.txt, eval (goto-char 2769), then press up arrow ==>

Breakpoint 1, bidi_shelve_cache () at ../../trunk/src/bidi.c:669
669	  databuf = xmalloc (alloc);
(gdb) p alloc
$1 = 292820 ;;; ~290K
(gdb) bt 8
#0  bidi_shelve_cache () at ../../trunk/src/bidi.c:669
#1  0x00000000004518d2 in move_it_in_display_line_to (it=0x7fffffff9b60, to_charpos=2769, to_x=0, op=(MOVE_TO_X | MOVE_TO_POS))
     at ../../trunk/src/xdisp.c:8339
#2  0x00000000004542d7 in move_it_to (it=0x7fffffff9b60, to_charpos=2769, to_x=-1, to_y=593, to_vpos=-1, op=10)
     at ../../trunk/src/xdisp.c:8941
#3  0x000000000043a193 in pos_visible_p (w=0x10e6518, charpos=2769, x=0x7fffffffa93c, y=0x7fffffffa938, rtop=0x7fffffffa94c,
     rbot=0x7fffffffa948, rowh=0x7fffffffa944, vpos=0x7fffffffa940) at ../../trunk/src/xdisp.c:1409
#4  0x00000000004aba8c in Fpos_visible_in_window_p (pos=..., window=..., partially=...) at ../../trunk/src/window.c:1812
#5  0x000000000057f82b in Fposn_at_point (pos=..., window=...) at ../../trunk/src/keyboard.c:10730
#6  0x000000000060cf02 in Ffuncall (nargs=1, args=0x7fffffffab10) at ../../trunk/src/eval.c:2818
#7  0x000000000065681f in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=2, args=0x7fffffffb3b0)
     at ../../trunk/src/bytecode.c:919
(More stack frames follow...)
(gdb) c
Continuing.

Breakpoint 4, bidi_unshelve_cache (databuf=0x7fffe1a16010, just_free=true) at ../../trunk/src/bidi.c:756
756	      xfree (p);

etc. I can even do:

(gdb) c 1000
Will ignore next 999 crossings of breakpoint 1.  Continuing.

Breakpoint 4, bidi_unshelve_cache (databuf=0x7fffe19ce010, just_free=true) at ../../trunk/src/bidi.c:756
756	      xfree (p);

and the cursor is not moved yet.

Dmitry