Created
June 22, 2020 21:27
-
-
Save nim4n136/35d298b665329a904ebeeab7fc07d0e0 to your computer and use it in GitHub Desktop.
Multi porccessing python
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 | |
import multiprocessing | |
def multiprocessing_func(x): | |
print(x) | |
time.sleep(1) | |
if __name__ == '__main__': | |
starttime = time.time() | |
pool = multiprocessing.Pool(processes=100) | |
pool.map(multiprocessing_func, range(0,100)) | |
pool.close() | |
print('That took {} seconds'.format(time.time() - starttime)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment