You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I run the example in the document, the code is as the following: """test.py""" from math import hypot from random import random from scoop import futures import time def test(tries): return sum(hypot(random(), random()) < 1 for _ in range(tries)) def calcPi(nbFutures, tries): expr = futures.map(test, [tries] * nbFutures) return 4. * sum(expr) / float(nbFutures * tries) if __name__ == "__main__": bt = time.time() print("pi = {}".format(calcPi(3000, 5000))) print('time:', time.time() - bt)
I run this code in the windows cmd with the command "python -m scoop test.py",
however, it cost 33 seconds. Then I used "map" instead of "futures.map", it just cost 4 seconds.
What should I do to let SCOOP be able to speed up my code?
Thanks.
The text was updated successfully, but these errors were encountered:
Hello!
I run the example in the document, the code is as the following:
"""test.py""" from math import hypot from random import random from scoop import futures import time def test(tries): return sum(hypot(random(), random()) < 1 for _ in range(tries)) def calcPi(nbFutures, tries): expr = futures.map(test, [tries] * nbFutures) return 4. * sum(expr) / float(nbFutures * tries) if __name__ == "__main__": bt = time.time() print("pi = {}".format(calcPi(3000, 5000))) print('time:', time.time() - bt)
I run this code in the windows cmd with the command "python -m scoop test.py",
however, it cost 33 seconds. Then I used "map" instead of "futures.map", it just cost 4 seconds.
What should I do to let SCOOP be able to speed up my code?
Thanks.
The text was updated successfully, but these errors were encountered: