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

Function benchmark_function

strings/palindrome.py:84–89  ·  view source on GitHub ↗
(name: str)

Source from the content-addressed store, hash-verified

82
83
84def benchmark_function(name: str) -> None:
85 stmt = f"all({name}(key) == value for key, value in test_data.items())"
86 setup = f"from __main__ import test_data, {name}"
87 number = 500000
88 result = timeit(stmt=stmt, setup=setup, number=number)
89 print(f"{name:<35} finished {number:,} runs in {result:.5f} seconds")
90
91
92if __name__ == "__main__":

Callers 1

palindrome.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected