Skip to content

Instantly share code, notes, and snippets.

@TinfoilHat0
Created September 6, 2018 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TinfoilHat0/c509deb1219c268b9b2e8aa8e5e6cee5 to your computer and use it in GitHub Desktop.
Save TinfoilHat0/c509deb1219c268b9b2e8aa8e5e6cee5 to your computer and use it in GitHub Desktop.
api = Savoir(rpcuser, rpcpassword, rpchost, rpcport, chainName)
def fetchParallel(streamName, streamLen):
p = mp.Pool(processes=2)
args = [(streamName, False, streamLen, streamLen//2), (streamName False, streamLen//2, 0)]
start = time()
p.starmap(api.liststreamitems, args)
end = time()
return end-start
def fetchNormal(streamName, streamLen):
start = time()
api.liststreamitems(streamName, False, streamLen, 0)
end = time()
return end-start
# Both functions return similar values. I'd expect fetchParallel to be half of fetchNormal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment