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.')