Skip to content

Instantly share code, notes, and snippets.

@nim4n136
Created June 22, 2020 21:27
Show Gist options
  • Save nim4n136/35d298b665329a904ebeeab7fc07d0e0 to your computer and use it in GitHub Desktop.
Save nim4n136/35d298b665329a904ebeeab7fc07d0e0 to your computer and use it in GitHub Desktop.
Multi porccessing python
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