From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#57207: 29.0.50; Fontification is slow after e7b5912b23 (Improvements to long lines handling) Date: Mon, 15 Aug 2022 22:12:15 +0800 Message-ID: <871qthsiio.fsf@localhost> References: <87bksmx1j1.fsf@localhost> <5900f208367791fbdfe2@heytings.org> <87tu6d4txk.fsf@localhost> <835yitiucj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21812"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gregory@heytings.org, 57207@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 15 16:12:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNapL-0005Qx-Eu for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 16:12:23 +0200 Original-Received: from localhost ([::1]:55274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNapK-0004QK-1w for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 10:12:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNap0-0004Q1-6J for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 10:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53996) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNaoz-0002Nx-UT for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 10:12:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNaoz-0002u5-Ox for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 10:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Aug 2022 14:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57207 X-GNU-PR-Package: emacs Original-Received: via spool by 57207-submit@debbugs.gnu.org id=B57207.166057268811114 (code B ref 57207); Mon, 15 Aug 2022 14:12:01 +0000 Original-Received: (at 57207) by debbugs.gnu.org; 15 Aug 2022 14:11:28 +0000 Original-Received: from localhost ([127.0.0.1]:43745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNaoS-0002tB-0h for submit@debbugs.gnu.org; Mon, 15 Aug 2022 10:11:28 -0400 Original-Received: from mail-pg1-f182.google.com ([209.85.215.182]:40633) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNaoO-0002su-HQ for 57207@debbugs.gnu.org; Mon, 15 Aug 2022 10:11:26 -0400 Original-Received: by mail-pg1-f182.google.com with SMTP id 24so6595388pgr.7 for <57207@debbugs.gnu.org>; Mon, 15 Aug 2022 07:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=oIhGpHP+8BIaEZ6xBX4e8A2cnKxAZ8AlOE4ohcoqvas=; b=N49FQZWdxI2WF5995XzpoGmZzi1QeLioASqNoRK4VlfJSKxMAF6RHspNCt4v0IKLv9 WApVuJlXdiGKdymM+7AjpUK92yXf5viWhWSQsTY1GnQS8tnHZTuT5hSwyn+fGPQSZix0 jacYJqIz+rVSjgNXD0/1DufiEelwJc0OwDN1Qx/dT/hpoDDGYbUkWTEtUfjTqDO55GuS LYqJBiUzDayraBsEQ2AZzMGn12VMBgvwrgMG+qHwvUKP5E3Hwk6SdFHUdH201fNyk6rM oSz34PRhcqRf+Nv3QRAVrQKfhC279DZ5u/VNX/Pqp5+G9RaSnqaUdhUn3UmJCPOcJgNy WcDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=oIhGpHP+8BIaEZ6xBX4e8A2cnKxAZ8AlOE4ohcoqvas=; b=b3pn6a4H4RkMmtw/kGehZZ/WOTcfmrLf806O+dYObz/SRDoDLSMfYpNBY9lC9sstUM eQi/L1Yh+pHdbrop41YfVb52z18PzcbGe4wmHx3li/5yGbrh9aS5iWfl2ZViIPpOl8zf 2wKOnTEE0JBMa3Qpi6dNCvIGCGKvsj522vKyBXg0opJLLw1OlKETg3lXFKgRK/76V6OW MNqvYbpCUoU4v+eyKvIyCFORzSlWWaZpTXghNT/ZUslVKXiqTPTMwdGmFUPLWAvp0HMn iMBR6to3aqeWJB+xX/ZVUi3mYxFdCM0aRYpIiq2M3as+qsDbAudcSe9kpG87CmhlMNH9 mb2A== X-Gm-Message-State: ACgBeo0wAsXhjPeyJgfDS56e+K7X8lFHiDVOOhJy+ooX4ywuTvKqJrUH UcYn3lvBOJrYQO4TrN9eTl8= X-Google-Smtp-Source: AA6agR6iYRu1fOFzSgJOFgrjwVzYJIiE9MBRjJK0FjmLfT/SkhbkewaWh8rU5JX3v8jY+IIQtHlN2g== X-Received: by 2002:a65:4501:0:b0:3fc:4895:283b with SMTP id n1-20020a654501000000b003fc4895283bmr14367022pgq.231.1660572678557; Mon, 15 Aug 2022 07:11:18 -0700 (PDT) Original-Received: from localhost ([111.18.131.92]) by smtp.gmail.com with ESMTPSA id k133-20020a62848b000000b0052d24402e52sm1497022pfd.79.2022.08.15.07.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:11:17 -0700 (PDT) In-Reply-To: <835yitiucj.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:239800 Archived-At: Eli Zaretskii writes: >> (b) Setting long-line-threshold to nil makes the slowdown disappear. >> Increasing long-line-threshold to 100000 made Emacs hang. I had to kill >> it using kill -9. > > When it hangs, can you attach a debugger to it and try to figure out > where it loops? The instructions to do so are in etc/DEBUG, under "If > the symptom of the bug is that Emacs fails to respond". If that > procedure is more than you can afford, at least post the results of > "thread apply all bt" after attaching the debugger to a "hung" Emacs. Emacs with debugging support is generally slow on my large Org file, but I think that I managed to get some kind of backtrace with the default value of long-line-threshold. I typed C-z in GDB shell right after triggering the slow operation (it is headline unfolding in my testing). (I did confirm that setting long-line-threshold to nil makes the unfolding instant) The GDB log is below. Hope it gives some clues. ^Z Thread 1 "emacs" received signal SIGTSTP, Stopped (user). 0x00005555557e4840 in buf_bytepos_to_charpos (b=0x5555602f5ff0, bytepos=11098754) at marker.c:353 353 CONSIDER (tail->bytepos, tail->charpos); (gdb) step 358 if (best_above - bytepos < distance (gdb) finish Run till exit from #0 buf_bytepos_to_charpos (b=0x5555602f5ff0, bytepos=11098754) at marker.c:358 BYTE_TO_CHAR (bytepos=11098754) at /home/yantar92/Git/emacs/src/buffer.h:1053 1053 } Value returned is $1 = 10568710 (gdb) finish Run till exit from #0 BYTE_TO_CHAR (bytepos=11098754) at /home/yantar92/Git/emacs/src/buffer.h:1053 0x000055555581da55 in find_newline1 (start=10568693, start_byte=11098737, end=19968614, end_byte=20651065, count=0, counted=0x7fffffff9480, bytepos=0x0, allow_quit=true) at search.c:3260 3260 return BYTE_TO_CHAR (lim_byte + next); Value returned is $2 = 10568710 (gdb) finish Run till exit from #0 0x000055555581da55 in find_newline1 (start=10568693, start_byte=11098737, end=19968614, end_byte=20651065, count=0, counted=0x7fffffff9480, bytepos=0x0, allow_quit=true) at search.c:3260 0x0000555555610b5b in redisplay_window (window=XIL(0x5555564fed05), just_this_one_p=true) at xdisp.c:19594 19594 next = find_newline1 (cur, CHAR_TO_BYTE (cur), 0, -1, 1, Value returned is $3 = 10568710 (gdb) finish Run till exit from #0 0x0000555555610b5b in redisplay_window (window=XIL(0x5555564fed05), just_this_one_p=true) at xdisp.c:19594 redisplay_window_1 (window=XIL(0x5555564fed05)) at xdisp.c:17502 17502 return Qnil; (gdb) finish Run till exit from #0 redisplay_window_1 (window=XIL(0x5555564fed05)) at xdisp.c:17502 0x000055555587bb83 in internal_condition_case_1 (bfun=0x5555556086f9 , arg=XIL(0x5555564fed05), handlers=XIL(0x7ffff1b8da2b), hfun=0x555555608402 ) at eval.c:1521 1521 Lisp_Object val = bfun (arg); Value returned is $4 = XIL(0) (gdb) finish Run till exit from #0 0x000055555587bb83 in internal_condition_case_1 (bfun=0x5555556086f9 , arg=XIL(0x5555564fed05), handlers=XIL(0x7ffff1b8da2b), hfun=0x555555608402 ) at eval.c:1521 redisplay_internal () at xdisp.c:17044 17044 if (update_miniwindow_p) Value returned is $5 = XIL(0) (gdb) finish Run till exit from #0 redisplay_internal () at xdisp.c:17044 redisplay () at xdisp.c:16104 16104 } (gdb) finish Run till exit from #0 redisplay () at xdisp.c:16104 read_char (commandflag=1, map=XIL(0x55556c00a123), prev_event=XIL(0), used_mouse_menu=0x7fffffffd3dd, end_time=0x0) at keyboard.c:2645 2645 if (!input_pending) (gdb) finish Run till exit from #0 read_char (commandflag=1, map=XIL(0x55556c00a123), prev_event=XIL(0), used_mouse_menu=0x7fffffffd3dd, end_time=0x0) at keyboard.c:2645 0x00005555557a4ec1 in read_key_sequence (keybuf=0x7fffffffd5d0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:10045 10045 key = read_char (prevent_redisplay ? -2 : NILP (prompt), Value returned is $6 = make_fixnum(106) (gdb) c Continuing. ^Z Thread 1 "emacs" received signal SIGTSTP, Stopped (user). 0x00005555557e4873 in buf_bytepos_to_charpos (b=0x5555602f5ff0, bytepos=10121474) at marker.c:353 353 CONSIDER (tail->bytepos, tail->charpos); (gdb) step 358 if (best_above - bytepos < distance (gdb) finish Run till exit from #0 buf_bytepos_to_charpos (b=0x5555602f5ff0, bytepos=10121474) at marker.c:358 BYTE_TO_CHAR (bytepos=10121474) at /home/yantar92/Git/emacs/src/buffer.h:1053 1053 } Value returned is $7 = 9679581 (gdb) finish Run till exit from #0 BYTE_TO_CHAR (bytepos=10121474) at /home/yantar92/Git/emacs/src/buffer.h:1053 0x000055555581da55 in find_newline1 (start=9679550, start_byte=10121431, end=19968614, end_byte=20651065, count=0, counted=0x7fffffff9480, bytepos=0x0, allow_quit=true) at search.c:3260 3260 return BYTE_TO_CHAR (lim_byte + next); Value returned is $8 = 9679581 (gdb) finish Run till exit from #0 0x000055555581da55 in find_newline1 (start=9679550, start_byte=10121431, end=19968614, end_byte=20651065, count=0, counted=0x7fffffff9480, bytepos=0x0, allow_quit=true) at search.c:3260 0x0000555555610b5b in redisplay_window (window=XIL(0x5555564fed05), just_this_one_p=true) at xdisp.c:19594 19594 next = find_newline1 (cur, CHAR_TO_BYTE (cur), 0, -1, 1, Value returned is $9 = 9679581 (gdb) finish Run till exit from #0 0x0000555555610b5b in redisplay_window (window=XIL(0x5555564fed05), just_this_one_p=true) at xdisp.c:19594 redisplay_window_1 (window=XIL(0x5555564fed05)) at xdisp.c:17502 17502 return Qnil; (gdb) finish Run till exit from #0 redisplay_window_1 (window=XIL(0x5555564fed05)) at xdisp.c:17502 0x000055555587bb83 in internal_condition_case_1 (bfun=0x5555556086f9 , arg=XIL(0x5555564fed05), handlers=XIL(0x7ffff1b8da2b), hfun=0x555555608402 ) at eval.c:1521 1521 Lisp_Object val = bfun (arg); Value returned is $10 = XIL(0) (gdb) finish Run till exit from #0 0x000055555587bb83 in internal_condition_case_1 (bfun=0x5555556086f9 , arg=XIL(0x5555564fed05), handlers=XIL(0x7ffff1b8da2b), hfun=0x555555608402 ) at eval.c:1521 redisplay_internal () at xdisp.c:17044 17044 if (update_miniwindow_p) Value returned is $11 = XIL(0) (gdb) finish Run till exit from #0 redisplay_internal () at xdisp.c:17044 redisplay () at xdisp.c:16104 16104 } (gdb) finish Run till exit from #0 redisplay () at xdisp.c:16104 read_char (commandflag=1, map=XIL(0x55556c7b89c3), prev_event=XIL(0), used_mouse_menu=0x7fffffffd3dd, end_time=0x0) at keyboard.c:2645 2645 if (!input_pending) (gdb) c Continuing. [Detaching after vfork from child process 4901] [Detaching after vfork from child process 4902] [Detaching after vfork from child process 4903] [Detaching after vfork from child process 4904] [Detaching after vfork from child process 4905] [Detaching after vfork from child process 4906] [Thread 0x7fffeb7fe640 (LWP 32537) exited] [Thread 0x7fffebfff640 (LWP 32536) exited] [Thread 0x7ffff0cc4640 (LWP 32535) exited] [Inferior 1 (process 32532) exited normally] (gdb) q -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92