Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python-concurrency/cpu_processes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import concurrent.futures
import time
from concurrent.futures import ProcessPoolExecutor


def main():
start_time = time.perf_counter()
with concurrent.futures.ProcessPoolExecutor() as executor:
with ProcessPoolExecutor() as executor:
executor.map(fib, [35] * 20)
duration = time.perf_counter() - start_time
print(f"Computed in {duration} seconds")
Expand Down
4 changes: 2 additions & 2 deletions python-concurrency/cpu_threads.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import concurrent.futures
import time
from concurrent.futures import ThreadPoolExecutor


def main():
start_time = time.perf_counter()
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
with ThreadPoolExecutor(max_workers=5) as executor:
executor.map(fib, [35] * 20)
duration = time.perf_counter() - start_time
print(f"Computed in {duration} seconds")
Expand Down
4 changes: 2 additions & 2 deletions python-concurrency/io_threads.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import concurrent.futures
import threading
import time
from concurrent.futures import ThreadPoolExecutor

import requests

Expand All @@ -19,7 +19,7 @@ def main():


def download_all_sites(sites):
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
with ThreadPoolExecutor(max_workers=5) as executor:
executor.map(download_site, sites)


Expand Down
Loading