all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: 26397@debbugs.gnu.org
Subject: bug#26397: 25.1; call-process slow on macOS and slower on larger frames
Date: Sat, 8 Apr 2017 20:19:59 +0100	[thread overview]
Message-ID: <20170408191959.GA7541@breton.holly.idiocy.org> (raw)
In-Reply-To: <CAHyO48wNKPu_MUT2sotiQPPVom=cttY9argqYJyYJ2NUG0mxgQ@mail.gmail.com>

On Sat, Apr 08, 2017 at 08:47:25AM -0700, Aaron Jensen wrote:
> On Sat, Apr 8, 2017 at 12:37 AM, YAMAMOTO Mitsuharu
> <mituharu@math.s.chiba-u.ac.jp> wrote:
> >
> > 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.
>
> Wow, that does make a big difference. The comment says that Emacs
> hangs when evaluating:
> 
> (make-comint "test0" "/nodir/nofile" nil "")
> 
> But I can not reproduce that currently with vfork. I do not understand
> the second comment: "Also, setsid is not allowed in the vfork child's
> context as of Darwin 9/Mac OS X 10.5."

It looks to me like we could replace the call to setsid with

    setpgid (0, 0);

for Darwin builds. However I can’t tell for sure if that function is
allowed after vfork, as I can’t even find any official reference to
setsid not being allowed.

I’m probably just not looking hard enough.

It seems the ‘correct’ solution for macOS is to use posix_spawn
instead of (v)fork/exec, but that would probably require a larger
change, and Daniel Colascione seems to have looked into it before, and
come across this very issue:

https://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00078.html

He doesn’t seem to have got an answer, though, and Emacs no longer
falls back to setpgid on any platform (see commit
dd0333b6155c9c3aabdac9418c005e2e5b4796e7).

> How might I test that?

The call to setsid is inside an `if` that’s to do with ptys. I suspect
it must come into play if you’re using Emacs in a text terminal,
rather than as a GUI app. I can’t check this just now as my master
won’t build...

-- 
Alan Third





  reply	other threads:[~2017-04-08 19:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08  6:25 bug#26397: 25.1; call-process slow on macOS and slower on larger frames Aaron Jensen
2017-04-08  7:37 ` YAMAMOTO Mitsuharu
2017-04-08 15:47   ` Aaron Jensen
2017-04-08 19:19     ` Alan Third [this message]
2017-04-09 13:01       ` Alan Third
2017-04-09 15:07         ` Aaron Jensen
2017-04-09 19:18           ` bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397) Alan Third
2017-04-09 20:32             ` Andreas Schwab
2017-04-09 21:34               ` Alan Third
2017-04-09 23:46             ` YAMAMOTO Mitsuharu
2017-04-10  0:06               ` Aaron Jensen
2017-04-10  1:11                 ` YAMAMOTO Mitsuharu
2017-04-10  4:13                   ` Aaron Jensen
2017-04-10 15:42                   ` bug#26397: [PATCH v2] " Alan Third
2017-04-11  7:06                     ` YAMAMOTO Mitsuharu
2017-04-18  2:29                     ` Aaron Jensen
2017-04-18 10:48                       ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170408191959.GA7541@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=26397@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.