Subject: bug#26397: 25.1; call-process slow on macOS and slower on larger frames

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Sat, 08 Apr 2017 16:37:29 +0900

>>>>> On Fri, 7 Apr 2017 23:25:24 -0700, Aaron Jensen <[email-masked]> said:

> It seems that `call-process' on macOS is quite a bit slower than it is
> on linux. Not only that, but the performance degrades as the frame gets
> larger.

> Using this as a benchmark in 'emacs -Q':

> (benchmark 1 '(call-process "/usr/bin/true" nil nil nil))

> With a small frame (default emacs size):

> Elapsed time: 0.003509s

> With a larger frame (about 1500x1500px):

> Elapsed time: 0.007011s

> On Linux it's been reported that times are typically in the 1-2ms range.

> I originally came across this via this magit issue:
> https://github.com/magit/magit/issues/2909 because magit, for many
> common operations, can call call-process many times, making the
> performance difference significant. Note that people in the thread are
> seeing even worse performance.

Probably "fork" copies some GUI resources.  That would also explain
why the performance is worse on the Mac port, where each frame
allocates an extra NSWindow for overlaying.

It becomes much faster and seemingly unaffected by the frame size if
you comment out "#undef HAVE_WORKING_VFORK" and "#define vfork fork"
in src/conf_post.h.  But I'm not sure if it is safe.

				     YAMAMOTO Mitsuharu
				[email-masked]