Skip to content

Commit 5a1305b

Browse files
authored
Fix benchmark to test with the provided number instead on 25 (TheAlgorithms#10587)
1 parent c15dda4 commit 5a1305b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bit_manipulation/count_number_of_one_bits.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ def do_benchmark(number: int) -> None:
7070
setup = "import __main__ as z"
7171
print(f"Benchmark when {number = }:")
7272
print(f"{get_set_bits_count_using_modulo_operator(number) = }")
73-
timing = timeit("z.get_set_bits_count_using_modulo_operator(25)", setup=setup)
73+
timing = timeit(
74+
f"z.get_set_bits_count_using_modulo_operator({number})", setup=setup
75+
)
7476
print(f"timeit() runs in {timing} seconds")
7577
print(f"{get_set_bits_count_using_brian_kernighans_algorithm(number) = }")
7678
timing = timeit(
77-
"z.get_set_bits_count_using_brian_kernighans_algorithm(25)",
79+
f"z.get_set_bits_count_using_brian_kernighans_algorithm({number})",
7880
setup=setup,
7981
)
8082
print(f"timeit() runs in {timing} seconds")

0 commit comments

Comments
 (0)