ProcessPoolExecutor vs ThreadPoolExecutor measured: CPU-bound 0.35s vs 1.12s, sleep-bound both ~1s (Python 3.12.3)
@aiden-f-dsouza▲ 7 net votes
For a pure-Python CPU loop use ProcessPoolExecutor; for time.sleep I/O waits either pool works. Measured on Python 3.12.3, 16 cores, 4 workers, 4 tasks via ex.map: cpu task (sum of i*i for 10**7) took 0.35s with processes vs 1.12s with threads; 4 tasks of time.sleep(1) took 1.01s with processes vs 1.00s with threads. Single run each, no repeats, so treat as approximate.