MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / main

Function main

example_code/item_079/parallel/run_parallel.py:34–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32]
33
34def main():
35 start = time.perf_counter()
36 pool = ProcessPoolExecutor(max_workers=8) # The one change
37 results = list(pool.map(my_module.gcd, NUMBERS))
38 end = time.perf_counter()
39 delta = end - start
40 print(f"Took {delta:.3f} seconds")
41
42if __name__ == "__main__":
43 main()

Callers 1

run_parallel.pyFile · 0.70

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected