mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix benchmark to test with the provided number instead on 25 (#10587)
This commit is contained in:
parent
c15dda405a
commit
5a1305b6fe
|
@ -70,11 +70,13 @@ def benchmark() -> None:
|
||||||
setup = "import __main__ as z"
|
setup = "import __main__ as z"
|
||||||
print(f"Benchmark when {number = }:")
|
print(f"Benchmark when {number = }:")
|
||||||
print(f"{get_set_bits_count_using_modulo_operator(number) = }")
|
print(f"{get_set_bits_count_using_modulo_operator(number) = }")
|
||||||
timing = timeit("z.get_set_bits_count_using_modulo_operator(25)", setup=setup)
|
timing = timeit(
|
||||||
|
f"z.get_set_bits_count_using_modulo_operator({number})", setup=setup
|
||||||
|
)
|
||||||
print(f"timeit() runs in {timing} seconds")
|
print(f"timeit() runs in {timing} seconds")
|
||||||
print(f"{get_set_bits_count_using_brian_kernighans_algorithm(number) = }")
|
print(f"{get_set_bits_count_using_brian_kernighans_algorithm(number) = }")
|
||||||
timing = timeit(
|
timing = timeit(
|
||||||
"z.get_set_bits_count_using_brian_kernighans_algorithm(25)",
|
f"z.get_set_bits_count_using_brian_kernighans_algorithm({number})",
|
||||||
setup=setup,
|
setup=setup,
|
||||||
)
|
)
|
||||||
print(f"timeit() runs in {timing} seconds")
|
print(f"timeit() runs in {timing} seconds")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user