From: "Tyler Dodge" <tyler@tdodge.consulting>
To: "Po Lu" <luangruo@yahoo.com>, "Stefan Kangas" <stefankangas@gmail.com>
Cc: "Emacs developers" <emacs-devel@gnu.org>
Subject: Re: "Significant Garbage Collection Improvement For Emacs" - sweep_conses performance improved by 50%?
Date: Fri, 28 Oct 2022 23:07:56 -0700 [thread overview]
Message-ID: <42ba5e8a-8a26-4afd-ab59-efbb967e8a24@app.fastmail.com> (raw)
In-Reply-To: <871qqr425n.fsf@yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
Hi,
I would not be surprised if you are correct in that cache locality has a greater
impact than the branch mispredictions. I'm also not certain that this
would have any effect on other builds than the Mac OS version, so I
would be curious to hear if it does have the same benefit. In my personal setup
with the change, the memory usage has not caused any issues, but I have not
measured it that closely. I think this change would make sense as a configure
flag.
Since writing that blogpost, I did attempt a few variations of adding prefetch
instructions in sweep_conses, but all of the variants I tried ended up having
significantly worse performance characteristics than omitting them. That makes
it a bit harder for me to believe that it's attributable to cache locality, but like
you said, there are a number of other reasons that could be the actual cause.
Tyler Dodge
On Fri, Oct 28, 2022, at 10:41 PM, Po Lu wrote:
> Stefan Kangas <stefankangas@gmail.com> writes:
>
> > In this blog post
> >
> > https://tdodge.consulting/blog/living-the-emacs-garbage-collection-dream
> >
> > the author asserts that a one-line patch "reduces the total wall clock
> > duration for sweep conses execution by approximately 50%", at least in
> > one benchmark. There are some caveats; read the blog post for the
> > full story.
>
> My guess is that the blog post overestimates the performance cost of
> branch predictor misses, and underestimates the real effect of the
> change, which is making sweep_conses walk an array more and a linked
> list less. Which is also more cache friendly, but sweeping any kind of
> array is intrinsically faster than doing the same to a linked list for
> any number of other reasons.
>
> I don't know what the memory consumption impact of such a change would
> be since I haven't tried it myself.
>
[-- Attachment #2: Type: text/html, Size: 2723 bytes --]
next prev parent reply other threads:[~2022-10-29 6:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 5:07 "Significant Garbage Collection Improvement For Emacs" - sweep_conses performance improved by 50%? Stefan Kangas
2022-10-29 5:19 ` Christopher Dimech
2022-10-29 5:41 ` Po Lu
2022-10-29 6:07 ` Tyler Dodge [this message]
2022-10-29 14:32 ` Stefan Monnier
2022-10-30 0:53 ` Po Lu
2023-02-11 20:10 ` Ihor Radchenko
2023-02-12 21:58 ` Konstantin Kharlamov
2023-02-13 20:07 ` Konstantin Kharlamov
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=42ba5e8a-8a26-4afd-ab59-efbb967e8a24@app.fastmail.com \
--to=tyler@tdodge.consulting \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.com \
--cc=stefankangas@gmail.com \
/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).