Update parallel_calculations_with_python_using_Pool.py
This commit is contained in:
@@ -15,9 +15,9 @@ def run_proc(name):
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start_time = time.time()
|
start_time = time.perf_counter()
|
||||||
with multiprocessing.Pool() as pool:
|
with multiprocessing.Pool() as pool:
|
||||||
results = pool.map(run_proc, [f"task {i}" for i in range(64)])
|
results = pool.map(run_proc, [f"task {i}" for i in range(64)])
|
||||||
end_time = time.time()
|
end_time = time.perf_counter()
|
||||||
print(results)
|
print(results)
|
||||||
print(end_time - start_time)
|
print(end_time - start_time)
|
Reference in New Issue
Block a user