all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@protonmail.com>
To: Eval Exec <execvy@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [MPS test] Is there some customization options for `scratch/igc` feature?
Date: Thu, 08 Aug 2024 16:25:06 +0000	[thread overview]
Message-ID: <87sevfrnhc.fsf@protonmail.com> (raw)
In-Reply-To: <CAKfPJDrJZm5FoWZvqXwSKgA=GKSH_6jcjX-P711Y87KGQQwq6A@mail.gmail.com>

"Eval Exec" <execvy@gmail.com> writes:

> I'm helping to test `scratch/igc` branch (commit id: 42731228d24) .

Thanks again! Any news on the X toolkit problem, or can I push that
patch?

> At start, my cursor is in buffer's top line, I long press [down] key
> and don't release, expect the cursor will move to bottom line. I feel
> lag, and buffer window doesn't update until I release [down] key.

I can reproduce this behavior, kind of, if I build with CFLAGS="-O0 -g3
-ggdb", my usual set; in an optimized build, things seem to work out
more like I would have expected.

> Then I see there is some message in `*Message*`:
> ```
> Garbage collecting...
> Generation 0 of a chain has reached capacity: start a minor collection.
> Garbage collecting...
> Generation 0 of a chain has reached capacity: start a minor collection.
> Garbage collecting...
> Generation 0 of a chain has reached capacity: start a minor collection.
> Garbage collecting...
> Generation 0 of a chain has reached capacity: start a minor collection.
> Garbage collecting...
> (many...)
> ```

What that means is that many garbage collections happen, which may be
unexpected or not depending on how many "many" is...

> What's the `capacity`?

All allocations in MPS happen in a generation; once the total size of
objects allocated in that generation reaches the "capacity", a minor GC
is triggered, which may take a long time during some of which the
generation is larger than its capacity.  So it's a bit of a misnomer.

> how can I config the `capacity`?

Right now, you have to go to igc.c and edit the line which reads:

  mps_gen_param_s gens[] = { { 128000, 0.8 }, { 5 * 128000, 0.4 } };

That means that there are two explicitly-specified generations: the
first has capacity ~128 MB (128000 times 1024 bytes), the second ~640 MB
(5 * 128000 * 1024 bytes). There's also an implicit last generation
which is "unlimited" in size and holds objects which have survived
collection twice.

The 0.8 and 0.4 values specify a mortality prediction for each
generation: this value is updated by MPS, so it's not that relevant.

It'd be nice to be able to change these values at run time, but MPS
doesn't seem to offer an API to change them then: we'd have to create
new pools with the new generation chain, and stop allocating in the
existing old pools.

The other problem is that the values are needed very early during Emacs
initialization, so the usual customization options aren't available.

On my branch, I've implemented a command line option which is parsed
early and specifies the sizes of the generation chain, so I can
experiment with them, but I haven't really gotten around to that and had
a fairly embarrassing bug in my code until just now which would have
rendered such experiments useless anyway.

Anyway, the patch is at:
https://codeberg.org/pipcet/emacs/commit/8e28cde297fe0b1a4f8a333e9abee17d76588a7c

> I think the
> lag is related to the `capacity`

I don't know at which point we suspend redisplay to handle further key
presses, I must confess. Can you see whether the behavior is different
for (while t (forward-line 1) (redisplay t)) ?

Pip




  reply	other threads:[~2024-08-08 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08  7:17 [MPS test] Is there some customization options for `scratch/igc` feature? Eval Exec
2024-08-08 16:25 ` Pip Cet [this message]
2024-08-08 17:00   ` Eval Exec

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=87sevfrnhc.fsf@protonmail.com \
    --to=pipcet@protonmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=execvy@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 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.