unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lynn Winebarger <owinebar@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Loading tramp for dump goes into infinite regress
Date: Tue, 9 Aug 2022 08:29:13 -0400	[thread overview]
Message-ID: <CAM=F=bCe2ZW5TcL+OH09V2DP=UfzU870Xoy=fEw+vFUVFUmd8Q@mail.gmail.com> (raw)
In-Reply-To: <83r129e1op.fsf@gnu.org>

I wanted to circle back and answer this now that I have a working "mega-dump".

On Mon, Jul 25, 2022 at 9:56 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > Another benefit I expect from native-compilation, dumped or not, is more efficient memory use when running
> > multiple emacs processes.  With dumping, I would expect (or hope for) better garbage collector behavior
> > since the amount of allocation required for the loaded modules should be pre-determined (whether byte- or
> > native-compiled).  If the image is 300MB (including the shared libraries), so be it, as long as the memory is
> > shared between multiple processes.
>
> I don't think I understand this expectation, and I don't think
> natively-compiled code has any advantages wrt GC over the
> byte-compiled code.

There should be at least one advantage - code representing function
calls to other byte code (even in the same compilation unit) are
represented by references in the heap which must be traced by the GC.
Take this with a block of salt, as I have not verified by inspection
of the natively compiled code, but many of those heap references
should be translated to control transfers to other code addresses,
which are not in the heap allocated or traced by the GC.
But that isn't what I was referring to above.
The first statement was intended with regard to the efficiency of
using shared libraries with code in read-only pages between multiple
processes versus byte code being loaded into modifiable memory regions
along with mutable data, increasing the probability that the memory
will either be not shared from the start or become unshareable due to
a CoW fault.
The second statement was comparing dumped versus undumped performance,
whether native- or byte- compiled.  This isn't a novel observation,
but the dump is basically a one-shot mark-compact GC collection, and
the mmap'ed pdump files would ideally be treated like the old
generation of a generational collector, and so not traced in most (or
all) collection cycles.  This is (or should be) one benefit of pure
space, although the requirement that it be read-only could be dropped
as long as the write-barrier remains and is used to record any
inter-generational pointers to a root set traced by the collector.

> > I'd also like a baseline expectation of performance with native-compiled libraries in the dumped image.
>
> What kind of performance?

Primarily usability.  And I can report that going from undumped to
dumped native-compiled does massively improve performance.  I have not
measured byte-compiled versus native-compiled when both are dumped.
Even with 2100+ eln files being loaded, the startup is very fast even
loading my .init settings (that turn on all the Semantic minor modes,
for example).
When I turned on the profiler for a while, it reported about 45% of
the cpu time was in gc, which I found surprising.  It was a little
laggy in some places, but not "stop-the-world collection of a 200MB
heap" laggy.
I'm tempted to try a quickish hack to see if I can turn pure space
into a never-collected elder generation by making the size a static
variable instead of a define and pointing pure to the start of the
dump image, then modifying the write barrier as described above, just
for my local 28.1 variant.  I don't mind wasting the memory if it
keeps the heap traced by the collector to a reasonable size focused on
shorter-lived constructs than the ones that survive the dump
collection.  I'd be surprised if it worked that easily, though.

>
> I'm saying that your job could be easier if you did the first step
> with byte-compiled files.

And it was - thanks.

Let me know if there are any specific metrics that would be useful.  I
can't promise I'll be able to get back with details quickly (I may
have to create novel implementations of the algorithms on my personal
machines), but I will see what I can do.  The emacs dev team and
contributors have really made tremendous improvements since I last
considered using the emacs source for playing around with some
language implementation ideas somewhere in the 2004-2007 period.  I
thought the massive code base of dynamic scoping and the
implementation of closure with "funvecs" (as they were called then)
was just too big to contemplate, but you guys have done it.  "Closing
the loop" by enabling the dumping of additional natively compiled
libraries is a minor tweak in the code, but it makes a huge difference
if you're trying to make use of all the additional functionality
provided by the available add-on packages.

Lynn



  parent reply	other threads:[~2022-08-09 12:29 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24  0:47 Loading tramp for dump goes into infinite regress Lynn Winebarger
2022-07-24  7:55 ` Michael Albinus
2022-07-24 12:05   ` Lynn Winebarger
2022-07-24 12:23     ` Eli Zaretskii
2022-07-24 13:30       ` Lynn Winebarger
2022-07-24 13:34         ` Eli Zaretskii
2022-07-24 14:05           ` Lynn Winebarger
2022-07-24 14:09             ` Eli Zaretskii
2022-07-24 14:28               ` Lynn Winebarger
2022-07-24 16:00             ` Lynn Winebarger
2022-07-24 16:20               ` Lynn Winebarger
2022-07-24 16:31                 ` Eli Zaretskii
2022-07-25 12:49                   ` Lynn Winebarger
2022-07-25 13:56                     ` Eli Zaretskii
2022-07-26 11:24                       ` Lynn Winebarger
2022-07-27  0:58                         ` Lynn Winebarger
2022-07-27  2:48                           ` Lynn Winebarger
2022-07-27  8:31                             ` Lynn Winebarger
2022-08-09 12:29                       ` Lynn Winebarger [this message]
2022-08-09 12:36                         ` Po Lu
2022-08-09 13:22                           ` Lynn Winebarger
2022-08-09 13:42                             ` Po Lu
2022-08-09 15:55                               ` Lynn Winebarger
2022-07-25 16:54                     ` Stefan Monnier
2022-07-25 17:05                       ` Stefan Monnier
2022-07-26  0:28                       ` Lynn Winebarger
2022-07-26  1:10                         ` Lynn Winebarger
2022-08-06  6:07                       ` Lynn Winebarger
2022-08-06 12:57                         ` Lynn Winebarger
2022-08-06 15:39                           ` Lynn Winebarger
2022-08-06 20:23                             ` Working fully native-compiled "mega dump" (was Re: Loading tramp for dump goes into infinite regress) Lynn Winebarger
2022-08-06 20:52                               ` Lynn Winebarger
2022-07-25 20:11                     ` Loading tramp for dump goes into infinite regress Andrea Corallo
2022-07-31 20:22                       ` Lynn Winebarger
2022-08-03  9:58                         ` Lynn Winebarger
2022-08-03 12:22                           ` Eli Zaretskii
2022-08-03 14:53                             ` Native-compilation build process (was Re: Loading tramp for dump goes into infinite regress) Lynn Winebarger
2022-08-03 16:15                               ` Eli Zaretskii
2022-08-04  3:33                                 ` Lynn Winebarger
2022-08-05  1:57                                   ` Lynn Winebarger
2022-07-24 16:23               ` Loading tramp for dump goes into infinite regress Eli Zaretskii

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='CAM=F=bCe2ZW5TcL+OH09V2DP=UfzU870Xoy=fEw+vFUVFUmd8Q@mail.gmail.com' \
    --to=owinebar@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).