[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Indentation and gc
From: |
Ergus |
Subject: |
Re: Indentation and gc |
Date: |
Sat, 11 Mar 2023 12:17:30 +0100 |
On Sat, Mar 11, 2023 at 10:54:24AM +0000, Ihor Radchenko wrote:
Eli Zaretskii <eliz@gnu.org> writes:
;; Make gc pauses faster by decreasing the threshold again (from the increased
initial).
(setq gc-cons-threshold (* 20 1024 1024))
;; original value: 800 000
;; speed up reading from external processes
(setq read-process-output-max (* 1024 1024)) ;; 1mb
This can only be done around specific portions of code known in
advance to be long and GC-intensive. I don't think this kind of
technique can be used in the situation described by the OP.
May it be done when loading init.el and early-init.el?
Init files are commonly known to be resource-intensive. They also tend
to trigger GC more because the heap size is not yet very large and thus
`gc-cons-percentage' does not yet take precedence over `gc-cons-threshold'.
As for "known in advance", may Emacs keep track of how many GCs are
triggered by user commands and then adjust GC dynamically?
Hi Ihor:
I have this in my early-init since a few years now.
```
(defconst my/file-name-handler-alist file-name-handler-alist)
(defconst my/gc-cons-threshold (* 2 gc-cons-threshold))
(setq-default file-name-handler-alist nil
gc-cons-threshold most-positive-fixnum ;; Defer Garbage
collection
gc-cons-percentage 1.0
message-log-max 16384)
(add-hook 'window-setup-hook
(lambda ()
(setq file-name-handler-alist my/file-name-handler-alist
gc-cons-threshold my/gc-cons-threshold
gc-cons-percentage 0.1)
(let ((curtime (current-time)))
(message "Times: init:%.06f total:%.06f gc-done:%d"
(float-time (time-subtract after-init-time
before-init-time))
(float-time (time-subtract curtime before-init-time))
gcs-done)))
90)
```
This reduced my load time by 50% on GNU/Linux (a bit more indeed)... on
MS-Windows I am still above the 7 seconds with exactly same config (so
more than 14x slower than GNU/Linux... but I guess the problem is maybe
outside GNU Linux... antivirus virus and MS process creation slowness.)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: Indentation and gc, (continued)
- Re: Indentation and gc, Ihor Radchenko, 2023/03/13
- Re: Indentation and gc, Eli Zaretskii, 2023/03/13
- Re: Indentation and gc, Ihor Radchenko, 2023/03/13
- Re: Indentation and gc, Eli Zaretskii, 2023/03/13
- Re: Indentation and gc, Ihor Radchenko, 2023/03/14
- Re: Indentation and gc, Eli Zaretskii, 2023/03/14
- Re: Indentation and gc, Ihor Radchenko, 2023/03/15
- Re: Indentation and gc, Eli Zaretskii, 2023/03/13
- Re: Indentation and gc, Ihor Radchenko, 2023/03/14
- Re: Indentation and gc, Ihor Radchenko, 2023/03/11
- Re: Indentation and gc,
Ergus <=
- Re: Indentation and gc, Ihor Radchenko, 2023/03/11
- Re: Indentation and gc, Eli Zaretskii, 2023/03/11
- Re: Indentation and gc, Ihor Radchenko, 2023/03/11
- Re: Indentation and gc, Eli Zaretskii, 2023/03/11
- Re: Indentation and gc, Ihor Radchenko, 2023/03/11
- Re: Indentation and gc, Dr. Arne Babenhauserheide, 2023/03/11
- Re: Indentation and gc, Eli Zaretskii, 2023/03/11
- Re: Indentation and gc, Ihor Radchenko, 2023/03/11
- Re: Indentation and gc, Eli Zaretskii, 2023/03/11
- Re: Indentation and gc, Ihor Radchenko, 2023/03/11