diff --git a/benchmark.py b/benchmark.py new file mode 100644 index 0000000..ea0908a --- /dev/null +++ b/benchmark.py @@ -0,0 +1,24 @@ +from proofow import pow256 as proofow +from time import perf_counter + + +def benchmark_pow(difficulty, iterations): + values = [] + for i in range(iterations): + pw = proofow(difficulty) + values.append(measure(pw.work)) + return sum(values) / len(values) + + +def measure(what): + start = perf_counter() + what() + return perf_counter() - start + + +if __name__ == '__main__': + ITER = 1000 + print('Benchmarking proofow:\n') + for i in range(5): + print('{} iterations of difficuluty {} takes {} units of time'.format(ITER, i, benchmark_pow(i, ITER)*1000000)) + print('\nYou should see that each difficulity level roughly doubles in terms of computation time.')