Subject: bug#62975: 29.0.90; Forking processes on macOS has become very slow in Emacs 29

From: "M. Ian Graham" <[email-masked]>
Date: Sat, 22 Apr 2023 08:59:54 +0000

(Sorry for the no-wrap in my previous message. I'm a mailing list idiot
and trying to be better starting with this one.)

> To be useful, these observations should include invocation of other
> programs, not just of Git.

Here's a recipe spitball:

---
(message (emacs-version))
(let ((start-time (current-time)))
  (dotimes (n 100)
    (call-process "ls")
    (call-process "date")
    (call-process "echo" nil nil nil "foo")
    (call-process "gcc" nil nil nil "--version"))
  (message "time spent: %dms"
           (round (* 1000.0 (float-time (time-subtract (current-time) start-time))))))
---

emacs -Q --script recipe.el results against the same nix-built versions
as my previous message:

---
GNU Emacs 28.2 (build 1, x86_64-apple-darwin22.4.0, NS appkit-2299.50 Version 13.3 (Build 22E252))
time spent: 4809ms

GNU Emacs 29.0.90 (build 1, x86_64-apple-darwin22.3.0, NS appkit-2299.40 Version 13.2.1 (Build 22D68))
time spent: 4626ms
---

Variation between runs looks like +=200ms or so, so they're within noise
levels of each other.

The same recipe against homebrew-installed emacs-plus@28:

---
GNU Emacs 28.2 (build 1, x86_64-apple-darwin22.3.0, NS appkit-2299.40 Version 13.2.1 (Build 22D68)) of 2023-04-22
time spent: 4237ms
---

This one seems to be consistently faster, roughly a 10% time difference
between homebrew and nix installs. But I'm not yet seeing anything near
John's 7x difference. Good chance I'm not looking in the right place.

Would appreciate any concrete suggestions for recipe changes.

Thanks,
Ian

------- Original Message -------
On Saturday, April 22nd, 2023 at 16:53, Eli Zaretskii <[email-masked]> wrote:

> 
> 
> > Date: Sat, 22 Apr 2023 07:06:17 +0000
> 
> > From: "M. Ian Graham" [email-masked]
> > 
> > > Can someone else who uses Emacs 29 on macOS reproduce this regression
> > > in performance relative to Emacs 28?
> > 
> > I've observed the same general trend at the same general time but had trouble getting a clear handle on the difference.
> > 
> > Vague personal observations: I've noticed slowdown on macos (x86) but not linux in recent months, but in addition to moving emacs versions from v28 to master to v29 I've also changed installation methods from homebrew to nix+home-manager so that's a massive confounder.
> > 
> > Large loads of things like my org config, elfeed or magit seem sluggish now (often multiple seconds) where they were snappy before (sub-second), and my impression has been that either forking or I/O is much slower but I haven't done much narrowing. I'm unsure at present whether my own observations are due to emacs versions or nix/build/installation differences.
> > 
> > On magit specifically, I've followed the magit manual's advice re: the magit executable affecting perf (https://magit.vc/manual/magit/MacOS-Performance.html) but not seen significant changes there.
> > 
> > I just attempted to reproduce some difference via emacs -Q and a simple recipe, but haven't easily been able to see a signal. Below are my results for v28 vs v29, both installed via nix. I'm also slowly trying other installation methods with the same recipe to see if anything jumps out.
> > 
> > So far, v28 feels plenty slow too.
> 
> 
> Thanks.
> 
> To be useful, these observations should include invocation of other
> programs, not just of Git.
>