We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 09a44fd commit 30aabe7Copy full SHA for 30aabe7
project_euler/problem_073/sol1.py
@@ -71,6 +71,21 @@ def solution(max_d: int = 12_000) -> int:
71
fractions_number += 1
72
return fractions_number
73
74
+def benchmark() -> None:
75
+ """
76
+ Benchmarks
77
78
+ # Running performance benchmarks...
79
+ # slow_solution : 21.02750190000006
80
+ # solution : 15.79036830000041
81
+
82
+ from timeit import timeit
83
84
+ print("Running performance benchmarks...")
85
86
+ print(f"slow_solution : {timeit('slow_solution()', globals=globals(), number=10)}")
87
+ print(f"solution : {timeit('solution()', globals=globals(), number=10)}")
88
89
if __name__ == "__main__":
90
print(f"{solution() = }")
91
+ benchmark()
0 commit comments