New issue
Advanced search Search tips

Issue 869690 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 819228
Owner:
Closed: Aug 1
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Use posix_spawn when available

Project Member Reported by thomasanderson@chromium.org, Jul 31

Issue description

posix_spawn() is a replacement for fork+exec that can be much faster.  Here's a benchmark on Linux and Mac:
https://github.com/rtomayko/posix-spawn#benchmarks

fork()ing from the browser process is slow because all pages need to be marked copy-on-write.  Then when exec() runs, all of those pages are set back to read+write (or readonly or whatever it was before).  For large processes like Chrome, this can be very expensive.  The benchmark above suggests there's a 0.07s overhead on Linux when fork/exec is run from a 500MB process.

posix_spawn() creates a brand new process and runs in constant time.  The benchmark indicates it's ~35x faster for 500MB processes on Linux.

We have a seemingly harmless fork+exec on every browser start here:
https://cs.chromium.org/chromium/src/chrome/browser/shell_integration_linux.cc?rcl=84c251d6b35a0e4c0d5cbb7ec84f58ac2a52098f&l=191
which runs "xdg-settings check default-web-browser google-chrome.desktop".  We could get a speedup in browser start time by using posix_spawn() here instead.

I suggest we use posix_spawn() when available for base::GetAppOutputInternal().

Also relevant is bug 22703.

+thestig does this sound reasonable?
 
Have you seen  bug 179923 , bug 321329, and bug 819228? It sounds like many folks want this.
Mergedinto: 819228
Status: Duplicate (was: Assigned)

Sign in to add a comment