Jump to content

Python: Difference between revisions

4 bytes added ,  11 December 2020
Line 336: Line 336:
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor


executor = ThreadPoolExecutor(max_workers=len(os.sched_getaffinity(0)))
executor = ThreadPoolExecutor(max_workers=5 * len(os.sched_getaffinity(0)))
def do_something(a, b):
def do_something(a, b):
   return a + b
   return a + b