From: martin rudalics <rudalics@gmx.at>
To: eliz@gnu.org, 36032@debbugs.gnu.org
Subject: bug#36032: 27.0.50; Massive GC when shift-selecting text in HELLO
Date: Sat, 1 Jun 2019 09:45:40 +0200 [thread overview]
Message-ID: <4a17488e-1d18-bd2c-d08d-fc41998223d4@gmx.at> (raw)
In-Reply-To: <83d0jywgna.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]
> To reproduce:
>
> emacs -Q
> C-h h
> C-SPC
> C-f C-f C-f ....
>
> You will see a ~0.5 sec delay after each C-f, before its effect of
> extending the region is visible. The reason is GC after every
> keystroke, and it seems to be caused by the changes in commit 479f51a.
> That commit caused mode-line-default-help-echo to be called each time
> Emacs needs to redisplay the mode line, and that seems to produce lots
> of garbage, at least with the HELLO file.
Here the delays are considerably larger (one second at least) and
there is at least one GC after each keystroke, sometimes two. But I
can't confirm the remainder of what you say. Attached find two small
files.
Loading the first one (show-gc.el) with emacs -Q gives approximately
the same behaviors with Emacs 26.2.50 (which does not have the
'mode-line-default-help-echo' function) and Emacs 27.0.50 - at least
one GC per keystroke here.
Loading the second one (show-gc-he.el) with emacs -Q (Emacs 27.0.50
only) shows that there is one call of 'mode-line-default-help-echo'
per keystroke and I doubt that one such call can produce that much
garbage.
Also, customizing the option 'mode-line-default-help-echo' to nil does
not make any performance difference here.
All tested with 64-bit MSYS2 builds on Windows 10. If you get
different results please tell me. Also I have not installed the
Harfbuzz branch so OMMV.
> If this function cannot be optimized to produce less garbage, could we
> perhaps somehow cache the value of the help-echo and not recalculate
> it unless something really changed?
This is certainly a good idea. But I doubt it would have any impact
in the case at hand.
martin
[-- Attachment #2: show-gc.el --]
[-- Type: text/plain, Size: 153 bytes --]
(defvar gc 0)
(add-hook 'post-gc-hook (lambda () (setq gc (1+ gc))))
(defun show-gc () (message "gc: %s" gc))
(add-hook 'post-command-hook 'show-gc)
[-- Attachment #3: show-gc-he.el --]
[-- Type: text/plain, Size: 1936 bytes --]
(defvar gc 0)
(defvar he 0)
(add-hook 'post-gc-hook (lambda () (setq gc (1+ gc))))
(defun show-gc-he () (message "gc: %s ... he: %s" gc he))
(add-hook 'post-command-hook 'show-gc-he)
(defun mode-line-default-help-echo (window)
"Return default help echo text for WINDOW's mode line."
(let* ((frame (window-frame window))
(line-1a
;; Show text to select window only if the window is not
;; selected.
(not (eq window (frame-selected-window frame))))
(line-1b
;; Show text to drag mode line if either the window is not
;; at the bottom of its frame or the minibuffer window of
;; this frame can be resized. This matches a corresponding
;; check in `mouse-drag-mode-line'.
(or (not (window-at-side-p window 'bottom))
(let ((mini-window (minibuffer-window frame)))
(and (eq frame (window-frame mini-window))
(or (minibuffer-window-active-p mini-window)
(not resize-mini-windows))))))
(line-2
;; Show text make window occupy the whole frame
;; only if it doesn't already do that.
(not (eq window (frame-root-window frame))))
(line-3
;; Show text to delete window only if that's possible.
(not (eq window (frame-root-window frame)))))
(setq he (1+ he))
(when (or line-1a line-1b line-2 line-3)
(concat
(when (or line-1a line-1b)
(concat
"mouse-1: "
(when line-1a "Select window")
(when line-1b
(if line-1a " (drag to resize)" "Drag to resize"))
(when (or line-2 line-3) "\n")))
(when line-2
(concat
"mouse-2: Make window occupy whole frame"
(when line-3 "\n")))
(when line-3
"mouse-3: Remove window from frame")))))
prev parent reply other threads:[~2019-06-01 7:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 19:47 bug#36032: 27.0.50; Massive GC when shift-selecting text in HELLO Eli Zaretskii
2019-06-01 7:21 ` Eli Zaretskii
2019-06-01 7:49 ` martin rudalics
2019-06-01 7:53 ` martin rudalics
2019-06-01 11:53 ` Eli Zaretskii
2019-06-01 12:10 ` martin rudalics
2019-06-01 12:22 ` Eli Zaretskii
2019-06-01 14:01 ` martin rudalics
2019-06-01 15:54 ` Eli Zaretskii
2019-06-01 7:45 ` martin rudalics [this message]
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=4a17488e-1d18-bd2c-d08d-fc41998223d4@gmx.at \
--to=rudalics@gmx.at \
--cc=36032@debbugs.gnu.org \
--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.