From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 37321@debbugs.gnu.org
Subject: bug#37321: 27.0.50; Excessive gc in a use case (el-search)
Date: Sat, 14 Sep 2019 01:04:07 -0700 [thread overview]
Message-ID: <733d0142-51ee-55df-de0c-cca7c989b370@cs.ucla.edu> (raw)
In-Reply-To: <87woeidd4g.fsf@web.de>
[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]
On 9/8/19 8:25 AM, Michael Heerdegen wrote:
> my Emacs seems to have
> become slower independently from gc. There is still a slow down of
> searching by a factor of at least 3 or so that doesn't seem to be
> related to gc.
Have you tried turning on profiling to see what the problem might be?
I looked into it a bit, and I think the problem is related to this line in
el-search--flatten-tree:
(gc-cons-percentage 0.8)) ;Why is binding it here more effective than
binding it more top-level?
That binding is not effective in general, because it causes Emacs to do most of
its computation with gc-cons-percentage equal to 0.8, but a small amount of it
with gc-cons-percentage equal to 0.1 (the default value). This is in an attempt
to disable most GC. However, the attempt fails in master because when
gc-cons-percentage drops to 0.1 Emacs does a garbage collection pretty much
right away. (In Emacs 26, the code lucks out because Emacs happens to not look
at gc-cons-percentage during the brief time that it is 0.1, so it doesn't GC.)
Proposed ELPA fix attached; it should help performance in Emacs master (where I
checked in some changes recently to help master work a bit better on this
example). The abovementioned line shouldn't be needed in Emacs master.
There may be other places in el-search that would benefit from a change similar
to the attached patch, but I didn't investigate this.
[-- Attachment #2: 0001-Port-GC-tuning-to-Emacs-27-alpha.patch --]
[-- Type: text/x-patch, Size: 1249 bytes --]
From 3e85fb302a9cf88ed3668d41c4b2e4cdb7017c54 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 14 Sep 2019 01:01:20 -0700
Subject: [PATCH] Port GC tuning to Emacs 27 alpha
* packages/el-search/el-search.el (el-search-setup-search):
Set gc-cons-percentage to 0.8 while searching.
---
packages/el-search/el-search.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 4e9cd98a4..5e213cf2b 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -2168,11 +2168,12 @@ files (i.e. file names) to search in.
With optional FROM-HERE non-nil, the first buffer in this stream
should be the current buffer, and searching will start at the
current buffer's point instead of its beginning."
+ (let ((gc-cons-percentage 0.8))
(el-search-setup-search-1 pattern get-buffer-stream nil setup-function)
(if (not el-search-occur-flag)
(el-search-continue-search from-here)
(setq el-search-occur-flag nil)
- (el-search-occur)))
+ (el-search-occur))))
(defun el-search-stream-of-directory-files (&optional directory recurse)
"Return a stream of emacs-lisp files in DIRECTORY.
--
2.21.0
next prev parent reply other threads:[~2019-09-14 8:04 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 13:52 bug#37321: 27.0.50; Excessive gc in a use case (el-search) Michael Heerdegen
2019-09-07 14:23 ` Michael Heerdegen
2019-09-07 15:30 ` Michael Heerdegen
2019-09-08 1:11 ` Paul Eggert
2019-09-08 14:52 ` Michael Heerdegen
2019-09-08 15:25 ` Michael Heerdegen
2019-09-14 8:04 ` Paul Eggert [this message]
2019-09-14 8:37 ` Eli Zaretskii
2019-09-14 8:52 ` Paul Eggert
2019-09-14 9:57 ` Eli Zaretskii
2019-09-14 17:57 ` Paul Eggert
2019-09-14 18:16 ` Eli Zaretskii
2019-09-15 4:33 ` Richard Stallman
2019-09-16 23:53 ` Michael Heerdegen
2019-09-17 0:55 ` Paul Eggert
2019-09-21 0:41 ` Michael Heerdegen
2019-09-21 0:46 ` Michael Heerdegen
2019-09-21 6:19 ` Paul Eggert
2019-09-17 12:47 ` Noam Postavsky
2019-09-21 0:44 ` Michael Heerdegen
2019-09-25 9:42 ` Michael Heerdegen
2019-09-25 20:37 ` Paul Eggert
2019-09-26 11:42 ` Michael Heerdegen
2019-09-26 12:14 ` Eli Zaretskii
2019-09-26 13:03 ` Michael Heerdegen
2019-10-08 8:43 ` Michael Heerdegen
2019-10-08 9:09 ` Eli Zaretskii
2019-10-08 9:11 ` Michael Heerdegen
2019-10-08 9:19 ` Eli Zaretskii
2019-10-08 11:12 ` Michael Heerdegen
2019-10-08 12:11 ` Eli Zaretskii
2019-10-08 12:38 ` Michael Heerdegen
2019-10-08 13:03 ` Eli Zaretskii
2019-10-09 14:47 ` Michael Heerdegen
2019-10-09 15:33 ` Eli Zaretskii
2019-10-09 20:53 ` Paul Eggert
2019-10-10 10:58 ` Michael Heerdegen
2019-10-08 9:22 ` Michael Heerdegen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=733d0142-51ee-55df-de0c-cca7c989b370@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=37321@debbugs.gnu.org \
--cc=michael_heerdegen@web.de \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).