emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: funcall consing


From: Eli Zaretskii
Subject: Re: funcall consing
Date: Sat, 01 Jan 2022 09:26:20 +0200

> From: Richard Stallman <rms@gnu.org>
> Cc: andpuke@foxmail.com, tom@logand.com, emacs-devel@gnu.org
> Date: Fri, 31 Dec 2021 23:47:14 -0500
> 
>   > > The `80' indicats the GC has been invoked 80 times. That is the direct
>   > > indication of "consing".
> 
>   > Why are you saying that the number of times GC has been invoked is the
>   > direct indication of consing?
> 
> It used to be the case, and maybe still is that the decision on
> whether to call GC on any given occasion was controlled by how much
> space had been allocated since the previous GC.

It is still the case.  But the details matter in this case: we
actually call GC in some strategic points, regardless of how much
consing was made, and if it decides that not enough consing has
happened since the last call, it does nothing and immediately returns;
such "do-nothing" GC cycles then aren't counted in gcs-done.

> If that is true nowadays, then calling GC roughly measures the
> amount of consing.

Not necessarily.  If you write Lisp that rarely calls the functions
which call GC, then GC won't have enough opportunities to check how
much consing has happened.  This would produce fewer GC cycles,
although each cycle might collect more garbage.

Note that one of the examples posted by the OP does exactly twice GC
cycles that the other.  Which leads me to believe it had twice more
opportunities for checking how much consing was done.

So I think the caveat not to put too much faith in the _number_ of GC
cycles is still something important to keep in mind.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]