Browse Source

using time.perf_counter

multiprocess_search
Raphael Roberts 7 years ago
parent
commit
cda108c121
  1. 12
      test_mp.py

12
test_mp.py

@ -1,7 +1,11 @@
import timeit
import time
from hangman import load_words,filter_wordlist,ALPHABET
words = load_words('words.txt')
def test():
times_mp = timeit.timeit("filter_wordlist('.....',ALPHABET,words,True)",number = 20,globals=globals())
times_sc = timeit.timeit("filter_wordlist('.....',ALPHABET,words,False)",number = 20,globals=globals())
def test(input):
s = time.perf_counter()
filter_wordlist('.....',ALPHABET,words,True)
times_mp = time.perf_counter() - s
s = time.perf_counter()
filter_wordlist('.....',ALPHABET,words,False)
times_sc = time.perf_counter() - s
return dict(time_mp=times_mp,times_sc=times_sc)
Loading…
Cancel
Save