Fix benchmark to test with the provided number instead on 25 (#10587)

This commit is contained in:
ivan53 2023-10-16 07:48:26 -07:00 committed by GitHub
parent c15dda405a
commit 5a1305b6fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,11 +70,13 @@ def benchmark() -> None:
setup = "import __main__ as z"
print(f"Benchmark when {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"{get_set_bits_count_using_brian_kernighans_algorithm(number) = }")
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,
)
print(f"timeit() runs in {timing} seconds")