My postinstaller needs to compile some stuff.
Of course, the compile part should be finished as quickly as possible.
In the Handbook, section 24.5.4.2., there is something written about the
Now I am thinking about how an good formula that determines the number of compile threads could/should look.
My first thought looks like this:
Maybe somebody already has done research into that topic and found a good formula to determine how many threads can be used without thrashing?
Of course, the compile part should be finished as quickly as possible.
In the Handbook, section 24.5.4.2., there is something written about the
-j
directive.Now I am thinking about how an good formula that determines the number of compile threads could/should look.
My first thought looks like this:
Code:
my $mymemory = `sysctl hw.physmem`;
my $mycpus = `sysctl hw.ncpu`;
my $mymemorypercompilethread = 500000000;
my $myresidualmem = 1000000000;
my $maxthreadsinmem = ($mymemory - $myresidualmem) / $mymemorypercompilethread;
my $maxthreadslimit = $mycpus * 3;
my $threadstocompilewith =
($maxthreadslimit > $maxthreadsinmem)
? $maxthreadsinmem
: $maxthreadslimit;