]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
build parallelism: New way to figure that out.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 3 Feb 2013 20:40:16 +0000 (21:40 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 3 Feb 2013 20:40:16 +0000 (21:40 +0100)
The system will now use either the old formula,
CPU cores * 2 + 1 or the amount of memory in megabytes devided
by 128 (i.e. each compiler process can have 128M RAM) which ever
is less.

python/pakfire/system.py

index a9154de98c7ec53719423f7ff37fb7c4c38b9c3b..6d54d5ffa170bd40e7fc02475076c4ad724e1c8c 100644 (file)
@@ -157,14 +157,15 @@ class System(object):
                        simulatneously when compiling.
                """
                # Check how many processes would fit into the
-               # memory when each process takes up to 500MB.
-               multiplicator = self.memory / (500 * 1024 * 1024)
+               # memory when each process takes up to 128MB.
+               multiplicator = self.memory / (128 * 1024 * 1024)
                multiplicator = round(multiplicator)
 
                # Count the number of online CPU cores.
-               cpucount = os.sysconf("SC_NPROCESSORS_CONF")
+               cpucount = os.sysconf("SC_NPROCESSORS_CONF") * 2
+               cpucount += 1
 
-               return min(multiplicator, cpucount * 2)
+               return min(multiplicator, cpucount)
 
 
 # Create an instance of this class to only keep it once in memory.