Last active
February 6, 2021 02:10
-
-
Save eriky/0de249619e6db10fa47b7d47082b4c36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
# A CPU heavy calculation, just | |
# as an example. This can be | |
# anything you like | |
def heavy(n, myid): | |
for x in range(1, n): | |
for y in range(1, n): | |
x**y | |
print(myid, "is done") | |
def sequential(n): | |
for i in range(n): | |
heavy(500, i) | |
if __name__ == "__main__": | |
start = time.time() | |
sequential(80) | |
end = time.time() | |
print("Took: ", end - start) | |
# On my system, this takes | |
# about 46 seconds. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment