About Measuring Function Execution Time with Timeit
When using timeit
to measure function execution time, you will need to use the second parameter for the imports, for example:
import timeit
def function_in_question():
...
if __name__ == "__main__":
print(timeit.timeit(
"""function_in_question()""",
"""from __main__ import function_in_question""",
))
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You