emacs-devel
[Top][All Lists]
Advanced

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

Re: Indentation and gc


From: Gregor Zattler
Subject: Re: Indentation and gc
Date: Sat, 11 Mar 2023 18:10:33 +0100

Hi Eli, emacs developers,
* Eli Zaretskii <eliz@gnu.org> [2023-03-11; 17:32 +02]:
>> From: Ihor Radchenko <yantar92@posteo.net>
>> Cc: spacibba@aol.com, arne_bab@web.de, emacs-devel@gnu.org
>> Date: Sat, 11 Mar 2023 14:31:18 +0000

>> Given that modern computer typically have 4-16Gb RAM, the warning does
>> not look like an actual warning. 800kb is nothing. Surely, increasing it
>> to 80Mb to even few hundreds Mb is safe, right? Or not?
>
> Again, you are reasoning about the value as if it were related to the
> maximum memory footprint Emacs could have.  But in fact, it is related
> only to the _increment_ of memory Emacs can have before it should stop
> and consider how much of that is garbage.

But isn't that the very reason, why Ihors gc-cons-threshold
calculation in mid:878rg3wh2f.fsf@localhost is on the
save side memory wise?  Because it's a fraction of emacs
overall memory consumption anyway but scaled regarding
the total amount of memory?

To me the problem with big gc-cons-threshold even on systems
which are even bigger on RAM is that the (rare) garbage
collection the takes much more time and an uneducated
user might think Emacs hangs.

I played a lot recently witch gc-cons-threshold settings due
to Emacs being too sluggish with my old ones.  Now I:

- set gc-cons-threshold very high at the beginning of
  startup  (* 4096 40960)
- set it lower at the end of startup
  (/ (* 4096 4096) 1)
  - use gcmh with this value
- set it very high when entering the mini-buffer and
  lower again when exiting it
- force a gc when frame loses focs

The result is that with emacs-uptime being 7 hours, 21
minutes (and plenty of time away from the computer) I
have 103 messages regarding Garbage collection with
accompanied times for them in my message buffer.

Some statistics:

Minimal number  0.000   seconds
Maximal number  2.603   seconds
Sum     65.896  seconds
Average 0.63976699029126213592  seconds
Median  0.612   seconds
Variance        0.06970711075501932322
Standard deviation      0.26402104225803541665

Actually 0.6 seconds are already rather long I think.
But it's much better than before (on a ca. 9 years old
x240 with 8GB RAM)

Therefore I think some auto-adjustment of
gc-cons-threshold would be nice, which would try to
optimize for low number of garbage collection and short
times of actual gc runs.

Ciao; Gregor



reply via email to

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