Files
pythonprimes/measure.py
Reese Wells 47c752ff65 init
2018-07-29 17:25:09 -04:00

28 lines
802 B
Python

import simplefindprime as s, mediumfindprime as m, hardfindprime as h
message = "Time to run program: "
tests = 25
test_num = 1000
simpletime = 0
medtime = 0
hardtime = 0
for i in range(0, tests):
print("Test: " + str(i + 1))
simpletime += s.findxprimes(test_num)[1]
medtime += m.findxprimes(test_num)[1]
hardtime += h.findxprimes(test_num)[1]
simpletime /= tests
medtime /= tests
hardtime /= tests
print()
print(message + str(simpletime))
print(message + str(medtime))
print(message + str(hardtime))
print()
print("efficiency of medium vs simple: " + str(int(round(1/(medtime/simpletime),0))) + "x")
print("efficiency of hard vs medium: " + str(int(round(1/(hardtime/medtime), 0))) + "x")
print("efficiency of hard vs simple: " + str(int(round(1/(hardtime/simpletime), 0))) + "x")