MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / benchmark

Function benchmark

project_euler/problem_009/sol1.py:62–75  ·  view source on GitHub ↗

Benchmark code comparing two different version function.

()

Source from the content-addressed store, hash-verified

60
61
62def benchmark() -> None:
63 """
64 Benchmark code comparing two different version function.
65 """
66 import timeit
67
68 print(
69 timeit.timeit("solution()", setup="from __main__ import solution", number=1000)
70 )
71 print(
72 timeit.timeit(
73 "solution_fast()", setup="from __main__ import solution_fast", number=1000
74 )
75 )
76
77
78if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected