Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ThreadPoolExecutor if IO-bound

ProcessPoolExecutor if CPU-bound

for example

    with ThreadPoolExecutor(max_workers=4) as e:
        e.submit(shutil.copy, 'src1.txt', 'dest1.txt')
        e.submit(shutil.copy, 'src2.txt', 'dest2.txt')
but yeah if you're truly CPU bound then move to something lower level like C or Rust


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: