Tests show that fork() calls on Linux get slower as the parent process uses more memory. So do popen() and system().
Update: If you have glibc 2.24 (2016-08-05) or newer, you should use posix_spawn() instead which is a standard glibc function featuring similar performance results. You can also take a look at the aspawn project which demonstrates even better performance and is more flexible than posix_spawn().
This project is a much faster and more secure re-implementation of the Libc popen() and system() calls for Linux. The functions of this library can be used in currently existing source code which uses the standard popen() and system() functions. Small code modifications are required.
For more detailed information and benchmarks, please review the following blog pages:
Documentation, examples, unit tests and a performance benchmark tool are included in the source code.
A few caveats, as described in issue #11:
Any comments, positive or negative, are welcome. Send them directly to my Gmail address, or use the "Issues" tracker here.