1 Matching Annotations
  1. Dec 2023
    1. What would a version with multiprocessing look like?

      Pretty much the same, but, we use ProcessPoolExecutor instead.

      ```python from concurrent.futures import ProcessPoolExecutor, as_completed

      ...

      with ProcessPoolExecutor(max_workers=5) as executor: ... ```

      Note that here the number of workers maps to the number of CPU cores I want to dedicate to the program. Processes are way more expensive than threads, as each starts a new Python instance.