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

Function benchmark

strings/is_pangram.py:77–88  ·  view source on GitHub ↗

Benchmark code comparing different version.

()

Source from the content-addressed store, hash-verified

75
76
77def benchmark() -> None:
78 """
79 Benchmark code comparing different version.
80 """
81 from timeit import timeit
82
83 setup = "from __main__ import is_pangram, is_pangram_faster, is_pangram_fastest"
84 print(timeit("is_pangram()", setup=setup))
85 print(timeit("is_pangram_faster()", setup=setup))
86 print(timeit("is_pangram_fastest()", setup=setup))
87 # 5.348480500048026, 2.6477354579837993, 1.8470395830227062
88 # 5.036091582966037, 2.644472333951853, 1.8869528750656173
89
90
91if __name__ == "__main__":

Callers 1

is_pangram.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected