SHELL=/bin/sh vs bash performance
Michael Stahl
mstahl at redhat.com
Thu Sep 27 04:59:47 PDT 2012
On 27/09/12 13:57, Michael Stahl wrote:
> following numbers are from my Fedora 17 system, with the toy attachment
> that spawns 100k shells running "true" (only one run each):
argh... stupid me forgot to attach it and even clicked the wrong button
on the thunderbird warning...
-------------- next part --------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main(void)
{
char * shell = getenv("SHELL");
printf("%s\n", shell);
for (int i = 0; i < 100000; ++i)
{
if (fork())
{
wait(0);
}
else
{
char *const argv[] = { shell, "-c", "true", 0 };
execv(shell, argv);
}
}
}
More information about the LibreOffice
mailing list