mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-05 13:00:09 +03:00
cpu_count *2 is a step too far, the default is faster
This commit is contained in:
parent
bbd68ea9d4
commit
187e26524f
|
@ -1,7 +1,7 @@
|
||||||
# A monkey patch of the base distutils.ccompiler to use parallel builds
|
# A monkey patch of the base distutils.ccompiler to use parallel builds
|
||||||
# Tested on 2.7, looks to be identical to 3.3.
|
# Tested on 2.7, looks to be identical to 3.3.
|
||||||
|
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool, cpu_count
|
||||||
from distutils.ccompiler import CCompiler
|
from distutils.ccompiler import CCompiler
|
||||||
|
|
||||||
# hideous monkeypatching. but. but. but.
|
# hideous monkeypatching. but. but. but.
|
||||||
|
@ -29,12 +29,7 @@ def _mp_compile(self, sources, output_dir=None, macros=None,
|
||||||
depends, extra_postargs)
|
depends, extra_postargs)
|
||||||
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
||||||
|
|
||||||
try:
|
pool = Pool()
|
||||||
processes = cpu_count() * 2
|
|
||||||
except:
|
|
||||||
processes = 2
|
|
||||||
|
|
||||||
pool = Pool(processes)
|
|
||||||
print ("Building using %d processes" % pool._processes)
|
print ("Building using %d processes" % pool._processes)
|
||||||
arr = [(self, obj, build, cc_args, extra_postargs, pp_opts) for obj in objects]
|
arr = [(self, obj, build, cc_args, extra_postargs, pp_opts) for obj in objects]
|
||||||
results = pool.map_async(_mp_compile_one,arr)
|
results = pool.map_async(_mp_compile_one,arr)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user